Ask Your Question

Relation between cmd_vel and odometry twist data.?

asked 2012-09-26 10:34:36 -0500

abdullah gravatar image

updated 2012-09-26 12:55:23 -0500


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.

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2012-09-26 11:17:48 -0500

SL Remy gravatar image

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).

edit flag offensive delete link more


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.

abdullah gravatar image abdullah  ( 2012-09-26 12:54:16 -0500 )edit

Yes. The Odometry message contains the current Twist (and its covariance) at the time of that measurement.

joq gravatar image joq  ( 2012-09-26 13:14:13 -0500 )edit

answered 2012-11-27 20:16:46 -0500

nicole gravatar image

i also have this problem. i think linearV = (odom.twist.twist.linear.x); is the velocity of the robot, but observing the data obtained it isn't like that. So i confused if i am wrong? why?

edit flag offensive delete link more


Please read the support page before posting. Do not create answers for subsequent questions, comments or discussion. In your case, it's probably best to open a new question with more specific information about your setup, robot, etc.

Lorenz gravatar image Lorenz  ( 2012-11-28 00:37:05 -0500 )edit

answered 2012-09-26 11:20:00 -0500

Lorenz gravatar image

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

edit flag offensive delete link more

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: 2012-09-26 10:34:36 -0500

Seen: 2,399 times

Last updated: Nov 27 '12