ROS Answers: Open Source Q&A Forum - RSS feedhttps://answers.ros.org/questions/Open source question and answer forum written in Python and DjangoenROS Answers is licensed under Creative Commons Attribution 3.0Tue, 17 Mar 2015 04:03:35 -0500Suppose I have an orientation as roll, pitch, yaw. How can I transform it into quaternion?https://answers.ros.org/question/205084/suppose-i-have-an-orientation-as-roll-pitch-yaw-how-can-i-transform-it-into-quaternion/I am trying to represent a point (x,y,theta) as a quaternion. What is the easiest way to do that?Mon, 16 Mar 2015 09:41:25 -0500https://answers.ros.org/question/205084/suppose-i-have-an-orientation-as-roll-pitch-yaw-how-can-i-transform-it-into-quaternion/Answer by oogabooga for <p>I am trying to represent a point (x,y,theta) as a quaternion. What is the easiest way to do that?</p>
https://answers.ros.org/question/205084/suppose-i-have-an-orientation-as-roll-pitch-yaw-how-can-i-transform-it-into-quaternion/?answer=205155#post-id-205155Thanks. 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);
Tue, 17 Mar 2015 03:59:14 -0500https://answers.ros.org/question/205084/suppose-i-have-an-orientation-as-roll-pitch-yaw-how-can-i-transform-it-into-quaternion/?answer=205155#post-id-205155Comment by Chaos for <p>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? </p>
<pre><code>tf:: Quaternion rotation_rpy;
rotation_rpy.setRPY(x,y, theta);
geometry_msgs::Quaternion rotation_quat;
tf::quaternionTFToMsg(rotation_rpy, rotation_quat);
</code></pre>
https://answers.ros.org/question/205084/suppose-i-have-an-orientation-as-roll-pitch-yaw-how-can-i-transform-it-into-quaternion/?comment=205157#post-id-205157Try this
geometry_msgs::Quaternion quat = tf::createQuaternionMsgFromRollPitchYaw(roll, pitch, yaw);Tue, 17 Mar 2015 04:03:35 -0500https://answers.ros.org/question/205084/suppose-i-have-an-orientation-as-roll-pitch-yaw-how-can-i-transform-it-into-quaternion/?comment=205157#post-id-205157Answer by tfoote for <p>I am trying to represent a point (x,y,theta) as a quaternion. What is the easiest way to do that?</p>
https://answers.ros.org/question/205084/suppose-i-have-an-orientation-as-roll-pitch-yaw-how-can-i-transform-it-into-quaternion/?answer=205106#post-id-205106There are many libraries which can do that for you. Bullet, KDL, and Eigen all have methods. There's a summary of available methods [here](http://wiki.ros.org/geometry/RotationMethods)Mon, 16 Mar 2015 12:57:02 -0500https://answers.ros.org/question/205084/suppose-i-have-an-orientation-as-roll-pitch-yaw-how-can-i-transform-it-into-quaternion/?answer=205106#post-id-205106