Manipulator Basics · Theory · Module 03 of 14
03 — Coordinate Frames and Rotations
Every pose in robotics is a frame relative to another frame. Learn the 4×4 homogeneous transform, how to chain and invert transforms, and the main ways to write an orientation: matrices, Euler angles, axis-angle and quaternions.
A robot is a stack of coordinate frames: world, base, one per link, tool. Almost every computation in manipulation is a product of transforms between them, so this module is the arithmetic of the rest of the course.
Learning objectives
After this module you should be able to:
- Name the frames of a robot cell (world, base, joint, link, end-effector) and say what each one is for.
- Build a homogeneous transform from a rotation matrix and a translation vector, then compose and invert transforms.
- Convert a point between frames correctly, including the order of multiplication.
- Move between rotation matrices, ZYX Euler angles, axis-angle and unit quaternions, and know each one's pitfalls.
- State the defining properties of SO(3) and SE(3).
Conceptual explanation
A frame is an origin plus three perpendicular unit axes. In a robot cell we use several:
- the world frame W, fixed in the room, in which the cell layout (tables, parts, other robots) is measured;
- the base frame B, fixed to the robot's mounting flange; the controller expresses everything relative to it;
- the joint and link frames 1 … n, one rigidly attached to each link, placed by a convention such as Denavit–Hartenberg (Module 05);
- the end-effector frame E, or tool centre point (TCP) frame, at the working point of the tool, for example between the fingertips.
The pose of frame B relative to frame A is a rotation (the axes of B written in A) plus a translation (the origin of B written in A). Packing both into one 4×4 matrix lets a single multiplication rotate and translate a point. That makes chaining frames a matrix product.
Reading a transform
Read as "B seen from A". Its columns are B's x, y and z axes and B's origin, all in A coordinates. The subscripts chain like fractions, , and the inverse swaps them: .
Orientation representations
- Rotation matrix (9 numbers, 3 DOF): unambiguous, composes by multiplication; the standard internal form.
- Euler angles (3 numbers): intuitive (yaw, pitch, roll), but there are 12 axis orders, and they have a singularity (gimbal lock: at ZYX pitch ±90° yaw and roll merge).
- Axis-angle (unit axis and angle ): any rotation is one turn about one axis (Euler's theorem). The rotation vector is a natural orientation error.
- Unit quaternion (4 numbers, ): no singularity, cheap to compose and renormalise, and interpolates smoothly (slerp). and are the same rotation.
Mathematical formulation
A rotation matrix belongs to the special orthogonal group:
The elementary rotations about the coordinate axes:
A homogeneous transform is an element of the special Euclidean group SE(3):
Composition: rotate C's offset into A, then add B's origin.
Inversion is cheap: transpose the rotation and rotate the negated translation. Never use a general 4×4 inverse.
ZYX Euler angles (yaw , pitch , roll ), axis-angle (Rodrigues) and the quaternion:
Inverse map for ZYX: , and . These are undefined when : that is gimbal lock.
Diagrams
The frame figure in the conceptual section shows the chain of transforms in a cell. The interactive figure below draws a frame rotated by ZYX Euler angles and prints its rotation matrix.
Worked examples
Example 1: where is a point on the tool, in the world?
The robot stands at m in the world, turned 90° about z: . Its tool frame is at . A point 0.1 m along the tool's z axis, , is where in the world?
Check by reasoning: the tool's z axis is the base x axis (after ), which is the world y axis (after ). So the point is 0.1 m further along world y from the tool origin, which sits at . That gives , as computed.
Example 2: inverting the transform
To express a world point in the tool frame (for example a part seen by a camera), use :
Multiplying the two gives the identity to machine precision. Try it in Lab 02.
Example 3: one orientation, four representations
Yaw 30°, pitch 20°, roll 10° (ZYX) gives
The same rotation as axis-angle is a turn of about . As a unit quaternion it is , which satisfies . All three were computed by the engine and convert back to the same matrix.
Interactive experiment
Interactive rotation (needs JavaScript): R = Rz(ψ)Ry(θ)Rx(φ), with det R and the orthogonality error shown.
Real-world applications
- Cell layout: the robot's base frame is measured in the world frame so that CAD positions of fixtures can be sent to the robot.
- Tool changes: changing grippers only changes ; every program written for the TCP still works.
- Vision: a camera reports a part in its own frame; gives the grasp target.
- ROS 2 TF2 keeps exactly this tree of transforms and composes them on request.
Common mistakes
Multiplying in the wrong order
ATB BTC is not BTC ATB. Matrix products of rotations do not commute; check the sub- and superscripts chain like fractions.
Inverting a transform by negating it
The inverse of Trans(p)R is RTTrans(−p), whose translation is −RTp, not −p.
Mixing Euler conventions
"Roll-pitch-yaw" in one library may be XYZ about moving axes and in another ZYX about fixed axes. Always state the order and whether the axes are fixed or moving.
Interpolating Euler angles
Linearly interpolating Euler angles gives a curved, uneven motion and breaks near gimbal lock. Interpolate quaternions with slerp, or rotation vectors.
Forgetting that q and −q are the same rotation
Comparing quaternions element-wise can report a 360° error for identical orientations. Compare |q₁·q₂| with 1 instead.
Key takeaways
- A frame pose is a rotation in SO(3) plus a translation; together they form a 4×4 transform in SE(3).
- Chain transforms by multiplying in the order the subscripts cancel; invert with Rᵀ and −Rᵀp.
- The columns of ARB are B's axes written in A.
- Euler angles are readable but have singularities; quaternions and axis-angle do not, and are better for computation and interpolation.
Knowledge check
Write an answer to each question, then reveal the explanation. Your answers stay in your browser.
Question 1
If ATB has rotation R and translation p, what is the translation part of BTA?
Explanation
−Rᵀp: the origin of A seen from B. Negating p alone is wrong unless R = I.
Question 2
A transform has rotation R = Rz(90°) and translation (1, 0, 0). Where does it send the point (1, 0, 0)?
Explanation
R(1, 0, 0) = (0, 1, 0); adding the translation gives (1, 1, 0).
Question 3
Why does ZYX Euler angle extraction fail at pitch = 90°?
Explanation
With cos θ = 0, the formulas for ψ and φ use atan2(0, 0): yaw and roll rotate about the same axis, so only their sum (or difference) is defined. This is gimbal lock, a singularity of the representation, not of the rotation.
Question 4
What are the axis and angle of the quaternion [0, 0, 0, 1]?
Explanation
w = cos(θ/2) = 0, so θ = 180°, and the axis is (0, 0, 1): a half turn about z.
Question 5
Give two properties every rotation matrix must satisfy, and what each guarantees.
Explanation
RᵀR = I (the columns are orthonormal, so lengths and angles are preserved) and det R = +1 (a proper rotation, not a reflection).
Practise it in the labs
Then test yourself in practice exercises and challenge mode.
References and further reading
- K. M. Lynch and F. C. Park, Modern Robotics, Cambridge, 2017, chapter 3 (rigid-body motions).
- J. Diebel, "Representing attitude: Euler angles, unit quaternions, and rotation vectors", Stanford University technical report, 2006.
- P. Corke, Robotics, Vision and Control, 3rd ed., Springer, 2023, chapter 2.