Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Mathematically, there is no direct conversion from (linear.x, linear.y) to (linear.x_, angular.z). However, if what you need to do is have the robot follow the same path, you can fake it by a rotate operation, followed by a drive_forward operation.

Treat the two input x,y values as vectors, and find the vector sum. In step 1, rotate the robot in place to point in the same direction as this new vector. In step 2, move forward using a linear.x_ value based on the length of the vector. (I call it x_ to emphasize that in most cases it is not the same value as the input linear.x.)