how to get the linear velocity in the robot heading direction with gazebo/link_states?
I try to get the heading linear velocity from the /odom message which contains the twist message about the robot, but what the velocity shows in the twist message is along the x and y direction in the wolrd frame. I try to get the heading velocity with twist.linear.x / cos(yaw)[yaw is the robot heading obtained from /odom also ], I also try to compute the twist.linear.y/sin(alpha), and sqrt(vxvx + vyvy), these three result are not the at some point, I am confused about it. Besides, I have a urdf model in gazebo which is a diff drive robot, I found if can only set the twist.linear.x and twist.angular.z in the cmd_vel, the model can operate correctly in gazebo, how does it works without providing velocity in the y direction? how doest it know if the twist.linear.x I set is heading velocity of the robot or the one in the x direction of world frame?