ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Suppose I have an orientation as roll, pitch, yaw. How can I transform it into quaternion?

asked 2015-03-16 09:41:25 -0500

oogabooga gravatar image

updated 2015-03-16 09:42:28 -0500

I am trying to represent a point (x,y,theta) as a quaternion. What is the easiest way to do that?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2015-03-16 12:57:02 -0500

tfoote gravatar image

There are many libraries which can do that for you. Bullet, KDL, and Eigen all have methods. There's a summary of available methods here

edit flag offensive delete link more

answered 2015-03-17 03:59:14 -0500

oogabooga gravatar image

Thanks. I am aware of those methods. So I am doing it something like this and I hope that this does the job of transforming RPY into Quaternion. Is there any other way to do this?

tf:: Quaternion rotation_rpy;
rotation_rpy.setRPY(x,y, theta);
geometry_msgs::Quaternion rotation_quat;
tf::quaternionTFToMsg(rotation_rpy, rotation_quat);
edit flag offensive delete link more


Try this

geometry_msgs::Quaternion quat = tf::createQuaternionMsgFromRollPitchYaw(roll, pitch, yaw);
Chaos gravatar image Chaos  ( 2015-03-17 04:03:35 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-03-16 09:41:25 -0500

Seen: 797 times

Last updated: Mar 17 '15