Service Quiz cmd_vel frame

Hi, i know it is not the goal of the quiz to do a perfect square, however i wondered how to do it.

First, I use a simple control loop to achieve the rotation and the advance goals, like following

  1. Get the pose and the orientation from the odometry
  2. Calculate the error between the target and the current pose.
  3. Send a command of velocity (cmd_vel) proportional to this error vel = kp * err

The problem appers when the robot advance fordward, i have the following question:

In which frame are send the commands when we use Twist?. Because i use Rviz to show the path that the robot follow and in any moment the movement with twist.linear.x follow any x axes of any frame.


Hi @acevedos.alejandro,
Welcome to the community :).

The cmd_vel is in the robot’s frame. The x-axis points forward, the z-axis points up. So twisting on the z-axis turns the bot and linear.x moves forward (or backwards for negative values). I recommend not trying to achieve a perfect square. It takes skills learned further down the learning path. And a little tip: use low turning speeds (0.05). This way you can get fairly accurate with just a pre-baked timing control script.