ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

The first thing I would suggest is reading up a little bit about quaternions here. They are 4 dimensional unit vectors, so setting w=1 is only a valid quaternion in a very specific case.

Generating a rotation quaternion isn't the simplest thing in the world which is why several functions to do this are built into the ROS tf library. The tf::createQuaternionFromYaw function you've found is one of these and generates a valid rotation quaternion from a rotation about the Z axis.

To use this function you'll need to know the angle necessary to get to the goal point. For this you'll need to calculate the relative vector between the start and goal points then use the atan2(x,y) function to calculate the required angle.

Hope this helps.