# Relation between cmd_vel and odometry twist data?

I have some short questions please if anyone can answer these questions.

Q1: What will be the unit of angle when we use

angle = tf::getYaw(odom.pose.pose.orientation);


Q2: What should be the unit of linear and angular velocity when setting cmd_vel of diffrential drive robots? i.e.

cmdvel_.linear.x = vt;  // (m/s)
cmdvel_.angular.z = w;  // (rad/s) is it ok?


Q3: What is the unit of Odometry.twist.twist.angular.z?

Q4: If I want to find the previous velocity vector from Odometry data. Am I doing right? I want to find velocity vector in Odom frame?

linearV = (odom.twist.twist.linear.x);
angularV = (odom_globalVal.twist.twist.angular.z);

Vx = linearV * cos(angularV);  // wrong::its not an angle its angular velocity

Vy = linearV * sin(angularV);  // wrong


Thanks a lot.

Originally posted by abdullah on ROS Answers with karma: 81 on 2012-09-26

Post score: 0

Comment by Zuhair95 on 2022-08-15:
I hope you got to solve your issue! Please, to select the correct Gmapping odometry model noise (srr, srt, str, stt): Is it correct to calculate the RMSE between /cmd_vel/linear/x and /odom/twist/twsit/linear/x for translation and RMSE between /cmd_vel/angular/z and /odom/twist/twist/angular/z for rotation ?

Great references (and hopefully they clarify your questions too) are on the wiki and the REPs, e.g. distances are in meters, angles are in radians or more broadly, SI or SI-derived units are to be used (by everyone).

Remember that the twist message "expresses velocity in free space broken into it's linear and angular parts." So angular.z is the angular velocity (not an angle).

Originally posted by SL Remy with karma: 2022 on 2012-09-26

This answer was ACCEPTED on the original site

Post score: 5

Comment by abdullah on 2012-09-26:
Thanks, It helps a lot. In my implementation I want to find the previous velocity vector of differential drive robot. Is there any possibility that I can find it from Odometry data.

Comment by joq on 2012-09-26:
Yes. The Odometry message contains the current Twist (and its covariance) at the time of that measurement.

Comment by Zuhair95 on 2022-08-15:
Thanks for the information! Please, to select the correct Gmapping odometry model noise (srr, srt, str, stt): Is it correct to calculate the RMSE between /cmd_vel/linear/x and /odom/twist/twsit/linear/x for translation and RMSE between /cmd_vel/angular/z and /odom/twist/twist/angular/z for rotation ?

Have a look at the REP 103 that defines the standard units that should be used in ROS.

Originally posted by Lorenz with karma: 22731 on 2012-09-26

This answer was NOT ACCEPTED on the original site

Post score: 1