ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org

# Calculating path using linear and angular velocity published by odometry

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

Sort by » oldest newest most voted 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.

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?

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

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?

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.