ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The position part can be copied componentwise without any conversions. The orientation part is usually represented as Unit Quaternion due its numerically robustness, elegant computations and absence of singularities. But on the other hand, they are not intuitively interpretable.

Therefore you must convert your rotation around the z axis (also called yaw angle in terms of the ZYX euler representation).

The tf package provides handy methods for converting points and angles to geometry_msgs::Pose / tf::Pose and vice versa.

pose.orientation = tf::createQuaternionMsgFromYaw(angle);

Just check the Code API for more methods.

There are other questions regarding the conversion, e.g. http://answers.ros.org/question/41233/how-to-understand-robot-orientation-from-quaternion-yaw-angle/

The position part can be copied componentwise without any conversions. The orientation part is usually represented as Unit Quaternion due its numerically robustness, elegant computations and absence of singularities. But on the other hand, they are not intuitively interpretable.

Therefore you must convert your rotation around the z axis (also called yaw angle in terms of the ZYX euler representation).representation) to a Quaternion (represented by a 4D vector [w,x,y,z]^T).

The tf package provides handy methods for converting points and angles to geometry_msgs::Pose / tf::Pose and vice versa.

pose.orientation = tf::createQuaternionMsgFromYaw(angle);

Just check the Code API for more methods.

There are other questions regarding the conversion, e.g. http://answers.ros.org/question/41233/how-to-understand-robot-orientation-from-quaternion-yaw-angle/