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

Revision history [back]

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.