# cmd_vel components

In case of cmd_vel.linear.x what does the x_component of velocity signify. Is it the velocity in x_direction or in the direction the car is facing ? Even when I put the cmd_vel.linear.y to 0 its y-coordinate still changes.

edit retag close merge delete

Sort by » oldest newest most voted

It depends a little bit on what context you are asking this question in. Different applications may use the geometry_msgs/Twist fields in different ways. Generally speaking though, the velocities components listed in the message are meant to be body velocities i.e. the instantaneous velocity of a rigid body expressed in a body-fixed frame. So in most mobile robot platforms that conform to REP 103 (turtlesim, turtlebot, PR2, etc.) the x-component is always the forward velocity of the robot as seen from the robot's point of view. If you set the x-velocity component to be positive, the robot starts driving forward. Depending on the orientation of the robot, it's coordinates relative to some other frame (e.g. /map, /world) may be changing in more than one component.

The y-velocity component is the velocity that the robot should be translating "sideways". In a holonomic base (youBot, PR2), this velocity is significant. In a nonholonomic base (turtlebot), this velocity is ignored because the robot cannot have any velocity component in this direction (in the body-fixed frame).

The z-rotation component is the angular velocity of the robot about it's body-fixed, upward, z-axis (how fast is the robot spinning).

more

Hi! Let us know what kind of simulation and packages are you using? The changes in y -coordinate may be from the noise. Some simulation includes noise which makes vehicle moves although you do not command.

more