Robotics StackExchange | Archived questions

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.

Asked by Joy16 on 2016-06-30 19:53:33 UTC

Comments

Answers

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.

Asked by mgruhler on 2016-07-01 01:18:36 UTC

Comments

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?

Asked by Joy16 on 2016-07-04 14:50:23 UTC

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

Asked by mgruhler on 2016-07-05 03:02:51 UTC

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?

Asked by Joy16 on 2016-07-05 15:19:08 UTC

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.

Asked by mgruhler on 2016-07-08 05:41:18 UTC