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

Calculating path using linear and angular velocity published by odometry

asked 2016-06-30 19:53:33 -0600

Joy16 gravatar image

updated 2016-07-01 11:36:44 -0600

I have the message type nav_msgs/Odometry constantly publishing linear and angular velocity.

I am calculating linear distance by taking Velocity at X and Y, multiply them by 1/rate(Hz) and summing them together. Is this calculation right?

Also, I am a bit skeptical about calculating the turn using angular velocity. Any guidance here is appreciated.

I am visualizing the path in RViz. It would be great if you could point me to relevant source code that I could look into.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-07-01 01:18:36 -0600

mgruhler gravatar image

There is a tutorial about calculating odometry for an omnidirectional robot on the wiki. There is also example code.

About visualizing the path in rviz, simply publish a nav_msgs/Path message with the intermediate points that you visited.

edit flag offensive delete link more


Thanks! I was just curious why I am getting linear X and Y velocities published by the robot. Shouldn't it publish just Linear X velocity and Z angular velocity?

Joy16 gravatar image Joy16  ( 2016-07-04 14:50:23 -0600 )edit

Yes, if you have a differential drive robot. However, for omni-directional ones you do have y-velocities. Those can drive sideways.

mgruhler gravatar image mgruhler  ( 2016-07-05 03:02:51 -0600 )edit

That makes sense. But my robot here is a differential drive one. Still I am getting X and Y. Could it be because the message publishes it in map frame, which is why I am getting both X and Y. If yes, how do I interpret X and Y velocity in my map frame as? How do I calculate the distance?

Joy16 gravatar image Joy16  ( 2016-07-05 15:19:08 -0600 )edit

Then there is something wrong with your base driver. The odometry (i.e. the velocity) should always be published in the base_link (or whatever base frame name you have). Are you by any chance looking at the pose and not the twist? The pose is the integrated velocity and will change in x and y.

mgruhler gravatar image mgruhler  ( 2016-07-08 05:41:18 -0600 )edit

Question Tools

1 follower


Asked: 2016-06-30 19:53:33 -0600

Seen: 2,254 times

Last updated: Jul 01 '16