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

Revision history [back]

click to hide/show revision 1
initial version

The relationship between two frames is represented by a 6 DOF relative pose, a translation followed by a rotation. If /world and /sensor are two frames, the pose of /sensor in /frame is given by the translation from /world's origin to /sensor's origin, and the rotation of /sensor's coordinate axes in /world.

The translation is a vector in /world's coordinates, lets say v_s_w. It is represented by tf::Vector3.

The rotation of /sensor is given by a rotation matrix, represented as R_s_w, using same convention. The way to read this is: "the rotation of the frame /sensor in /world's coordinate system." The columns of R_s_w are formed from the three unit vectors of /sensor's axes in /world: r_x_s, r_y_s, and r_z_s.

There is no tf type for a rotation matrix; instead, tf represents rotations via tf::Quaternion (you could use an external library, such as KDL or Bullet, for transforming rotation matrix in quaternions and viceversa).

It's convenient to describe the translation + rotation in Homogeneous coordinates, as a single 4x4 matrix W_s_w. This can be read as: "the pose of frame /sensor relative to frame /world." The relative pose is constructed as follows:

                               W_s_w =  | R_s_w  v_s_w  |
                                        | 0 0 0    1    |

In tf, relative poses are represented as tf::Pose, which is equivalent to the bullet type btTransform or KDL::Frame. The member functions allow you to get the rotation (also the quaternion), and the translation of the pose. See respective class reference.

When you create a vector b_s in the /sensor frame you can obtain its components in the /world frame b_w by multiplying (in Homogeneous coordinates):

b_w = W_s_w * b_s

Obviously, you can apply the inverse transform in the opposite case (indicating with W_w_s = W_s_w^(-1)):

b_s = W_w_s * b_w

Hope this helps.

Good Luck!