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

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

asked 2016-02-29 23:26:51 -0600

fayazvf gravatar image

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 flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2016-03-01 01:02:41 -0600

Akif gravatar image

Orientation is in terms of Quaternion, not Euler angles. You can check

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.

edit flag offensive delete link more

answered 2016-03-01 01:08:12 -0600

mgruhler gravatar image

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.

edit flag offensive delete link more


Thanks for the help.

fayazvf gravatar image fayazvf  ( 2016-03-04 23:48:12 -0600 )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: 2016-02-29 23:26:51 -0600

Seen: 7,870 times

Last updated: Mar 01 '16