Coodinate Frames, Transforms, and TF
An excellent reference for coordinate frames and transforms is the first chapter of John Craig's book, Introduction to Robotics [1986, 1989]. We follow his conventions for transform and point indices.
Frames and Points
A frame is a coordinate system. Coordinate systems in ROS are always in 3D, and are right-handed, with X forward, Y left, and Z up.
Points within a frame are represented using tf::Point, which is equivalent to the bullet type btVector3. The coordinates of a point p in a frame W are written as Wp.
The relationship between two frames is represented by a 6 DOF relative pose, a translation followed by a rotation. If W and A are two frames, the pose of A in W is given by the translation from W's origin to A's origin, and the rotation of A's coordinate axes in W.
The translation is a vector in W's coordinates, WtA. It is represented by tf::Vector3, which is equivalent to btVector3.
The rotation of A is given by a rotation matrix, represented as WAR, using our convention of the reference frame as a preceeding superscript. The way to read this is: "the rotation of the frame A in W's coordinate system." The columns of R are formed from the three unit vectors of A's axes in W: WXA, WYA, and WZA.
There is no tf type for a rotation matrix; instead, tf represents rotations via tf::Quaternion, equivalent to btQuaternion. The bullet quaternion type has methods for creating quaternions from rotation matrices, and vice versa.
It's convenient to describe the translation + rotation in homogeneous coordinates, as a single 4x4 matrix WAT. This can be read as: "the pose of frame A relative to frame W." The relative pose is constructed as follows:
In tf, relative poses are represented as tf::Pose, which is equivalent to the bullet type btTransform. The member functions are getRotation() or getBasis() for the rotation, and getOffset() for the translation of the pose. See the bullet btTransform class reference.
Frame poses as Point Mappings
There is a duality between frame poses and mapping points from one frame to another. The pose WAT can also be read as, "transform a point in A's frame to W." The syntax gives a "cancellation" of the A frame: WATAp = Wp.
Mappings or transforms have their own type, tf::Transform. This is equivalent to the bullet btTransform, so essentially pose offsets and transforms are the same type. Transforms can be created using rotation matrices or quaternions for the rotation, and vectors for the translation. See the bullet btTransform class reference.
The inverse of a transform WAT is the transform AWT. The inverse maps points in the reverse direction from the original transform. Inverses are conveniently calculated using the inverse() member function of btTransform.