ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Your code looks fine. The problem here is your interpretation of the "orientation" -- which is in fact a quaternion, not euler angles. Therefore, orientation.z is not the rotation about the z axis, but rather a component of the quaternion. For instance, using the tf.transformations module in python, we can see that when your marker is perpendicular (euler rotation about z of 1.57 radians), we have:
quaternion_from_euler(0,0,1.57) = array([ 0. , 0. , 0.70682518, 0.70738827])
So the quaternion's "z" component will be 0.707 as you saw.
If you run the following (while your node is publishing tf messages):
rosrun tf tf_echo odom base_link
You can see the transformation in both euler angle and quaternion form.
2 | No.2 Revision |
Your code looks fine. The problem here is your interpretation of the "orientation" -- which is in fact a quaternion, not euler angles. Therefore, orientation.z is not the rotation about the z axis, but rather a component of the quaternion. For instance, using the tf.transformations module in python, we can see that when your marker is perpendicular (euler rotation about z of 1.57 radians), we have:
quaternion_from_euler(0,0,1.57) = array([ 0. , 0. , 0.70682518, 0.70738827])
So Quaternion components are labeled (x,y,z,w), so the quaternion's "z" component will be 0.707 as you saw.
If you run the following (while your node is publishing tf messages):
rosrun tf tf_echo odom base_link
You can see the transformation in both euler angle and quaternion form.