# What does Velocity in nav_msgs/Odometry actually mean?

I am confused with this type of data. What does the twist.twist.linear.x and twist.twist.linear.y actually represent?

I have a robot that can move either forward or backward and can ofcourse turn. In that case, doesn't the robot exhibit just velocity along X direction. Even if it turns, the robot's frame turns as well, still giving it a linear velocity along X direction. How come I am getting both X and Y velocity values here?

Originally posted by Joy16 on ROS Answers with karma: 112 on 2016-07-02

Post score: 0

## 1 Answer

Your understanding is correct. For a differential drive robot, the odom.twist.twist.linear.y = 0 as it is referred to the base_link frame. The other part of the Odometry message though will include X and Y position in the Odom frame.

See this page where the to different frames are called out. http://docs.ros.org/api/nav_msgs/html/msg/Odometry.html

As to why you are getting X and Y velocities, you'll have to provide some info on what your setup is.

.

Originally posted by billy with karma: 1850 on 2016-07-03

This answer was ACCEPTED on the original site

Post score: 2

### Original comments

Comment by Joy16 on 2016-07-04:
Thanks for your reply! I have a differential robot that follows a path. Child frame id is base_footprint. I am getting X,Y lin vel and Z for ang. vel . I need to trace the path in rviz, so I need to convert the velocity to distance and transform it to the world frame.

Comment by Joy16 on 2016-07-04:
Also in this tutorial, they seem to have taken both X and Y velocity for calculating the odometry

link text

Comment by billy on 2016-07-05:
The tutorial does include a y velocity component, so I take it to mean that the simulated data (robot) is not for a differential drive, but perhaps a holonomic type. Can you post the code for the publisher of the odom? It shouldn't matter but is the robot real or simulated?

Comment by Joy16 on 2016-07-05:
Hey! I don't have the code though. But it is a real robot. I just have the rosbag file recorded. I guess, when the frame is in map frame, it will have both X and Y velocity. It can have just X velocity when the frame of reference is in robot's frame(base_footprint). What do you think?