# What are the units of Odometry/orientation.z/w and Twist.angular.z fields?

I an new to ROS and am trying to understand the units in which the values in the Odometry.orientation.w and z fields and what do they represent. I am trying to rotate a turtlebot by a specific number of degrees. Is there a way to achieve it as I am able to set only angular velocities and whose unit I don't know either.

edit retag close merge delete

Sort by » oldest newest most voted

Orientation is in terms of Quaternion, not Euler angles. You can check http://answers.ros.org/question/22033...

For unit conventions you can check REP-0103. As you can check, angular velocity is rad/s if the code you use is convenient with REP-0103.

more

The orientation in ROS is (mostly) displayed as a quaternion. As such, it does not really have any units. You can, however, derive an angular representation (e.g. roll/pitch/yaw) from this, using one of the Rotation Methods, which then have radians as a unit.

• Python, from nav_msgs/Odometry, where msg is the full odometry msg:

(roll, pitch, yaw) = tf.transformations.euler_from_quaternion([msg.pose.pose.orientation.x, msg.pose.pose.orientation.y, msg.pose.pose.orientation.z, msg.pose.pose.orientation.w])

• C++, from nav_msgs/Odometry, where msg is the full odometry msg:

tf::Quaternion q(msg.pose.pose.orientation.x, msg.pose.pose.orientation.y, msg.pose.pose.orientation.z, msg.pose.pose.orientation.w);
tf::Matrix3x3 m(q);
double roll, pitch, yaw;
m.getRPY(roll, pitch, yaw);


(There are several more ways to do this. If someone has more efficient ones, please share.)

The Twist has units of m/s for the linear terms, as well as radian/s for the angular terms.

more

Thanks for the help.

( 2016-03-04 23:48:12 -0500 )edit