Robohouse ’26 Library
Contents

Chapter 9

Frames, rotations, and homogeneous transforms

4 sections · about 4 minutes

9.1 Why we need frames at all

The question "where is the gripper?" has no answer until you say "relative to what". A robot arm is a chain of rigid bodies, and the natural way to describe it is to attach a coordinate frame to each body and then describe how each frame relates to the one before it. The position of the tool relative to the table is then just the composition of all those relationships.

A frame is an origin point plus three mutually perpendicular unit vectors, conventionally x, y, and z, forming a right-handed set. When we say "the pose of the end effector", we mean the position of its frame's origin and the orientation of its axes, both expressed in some reference frame — usually the base frame, sitting at the bottom of the robot.

Pose therefore has six numbers: three for position and three for orientation. Six degrees of freedom — which is why a six-axis arm is the canonical design, six joints being exactly the number needed to reach an arbitrary position and an arbitrary orientation within the workspace.

9.2 Rotation matrices

The cleanest way to represent orientation for computation is a 3×3 rotation matrix. Its columns are the unit vectors of the rotated frame's axes, expressed in the reference frame. So if RR is the rotation of frame B relative to frame A, the first column of RR is B's x-axis written in A's coordinates.

Rotation matrices have properties that make them pleasant to work with. They are orthonormal: every column is a unit vector, and all columns are mutually perpendicular. Consequently the inverse of a rotation matrix is simply its transpose, which is free to compute. Their determinant is exactly +1+1. And they compose by multiplication: if RABR_{AB} rotates from A to B and RBCR_{BC} from B to C, then RAC=RABRBCR_{AC} = R_{AB} \cdot R_{BC}.

The elementary rotations about the three axes are worth memorising:

Rx(θ)=[1000cosθsinθ0sinθcosθ]Ry(θ)=[cosθ0sinθ010sinθ0cosθ]R_x(\theta) = \begin{bmatrix} 1 & 0 & 0 \\ 0 & \cos\theta & -\sin\theta \\ 0 & \sin\theta & \cos\theta \end{bmatrix} \qquad R_y(\theta) = \begin{bmatrix} \cos\theta & 0 & \sin\theta \\ 0 & 1 & 0 \\ -\sin\theta & 0 & \cos\theta \end{bmatrix} Rz(θ)=[cosθsinθ0sinθcosθ0001]R_z(\theta) = \begin{bmatrix} \cos\theta & -\sin\theta & 0 \\ \sin\theta & \cos\theta & 0 \\ 0 & 0 & 1 \end{bmatrix}

Note the sign pattern in RyR_y — it is the odd one out, and transcribing it wrongly gives kinematics that are wrong only in certain poses.

9.3 Euler angles

Nine numbers to describe three degrees of freedom is redundant, so people often use three angles instead: roll, pitch, and yaw, or some other Euler convention. These are convenient for humans — "rotate 30° about z, then 45° about the new y" is easy to picture.

They have two problems. First, there are two dozen distinct Euler conventions in common use, differing in axis order and in whether rotations are about fixed or moving axes, and almost nobody states which one they mean. If your robot's orientation is off in a way that looks almost right, suspect a convention mismatch first.

Second, and more fundamentally, every three-angle representation has singularities — configurations where two of the angles become degenerate and only their sum or difference is determined. This is gimbal lock, and it is not an implementation flaw — it is a topological necessity for any three-parameter representation of rotation.

For a robot arm this matters at the wrist. When joint 5 is at zero, joints 4 and 6 rotate about the same physical axis, and only their sum is determined by the desired orientation. The IK has infinitely many solutions and the solver has to decide what to do about it. It is a pose the arm will pass through in ordinary use, not a corner case.

Quaternions avoid the singularity by using four numbers with one constraint, and they interpolate cleanly, which makes them a good fit for orientation targets and for blending between orientations along a path. Use quaternions for storage and interpolation; convert to rotation matrices for the kinematics maths; use Euler angles only at the human interface.

9.4 Homogeneous transforms

The trick that makes robot kinematics tractable is to combine rotation and translation into a single 4×4 matrix:

T=[Rp01]T = \begin{bmatrix} R & p \\ 0 & 1 \end{bmatrix}

where RR is the 3×3 rotation and pp is the 3×1 translation. The bottom row is always [0001]\begin{bmatrix}0 & 0 & 0 & 1\end{bmatrix}.

The reason is that composition becomes matrix multiplication. If T1T_1 describes frame 1 relative to frame 0, and T2T_2 describes frame 2 relative to frame 1, then T1T2T_1 T_2 describes frame 2 relative to frame 0. A chain of six joints becomes a product of six matrices, and that is forward kinematics.

Points transform too. Write a 3D point as a 4-vector with a 1 appended, and TT times that vector gives the point in the new frame, with rotation and translation applied together.

The inverse has a closed form you should use rather than calling a general matrix inverse:

T1=[RTRTp01]T^{-1} = \begin{bmatrix} R^{\mathsf{T}} & -R^{\mathsf{T}} p \\ 0 & 1 \end{bmatrix}

It is exact and cheap, where a numerical 4×4 inversion is neither.