Skip to the lesson
FixTheRobot Explore Robotics / Linear Algebra / M7 Rotations and Rigid-Body Transformations / M7-T1

Linear Algebra · Theory · M7

M7-T1 — Coordinate Frames

A frame is an origin and a set of perpendicular axes. A pose tells you where one frame sits inside another. Everything in robot geometry is bookkeeping between frames.

  • Lesson 1 of 9
  • Module 7: Rotations and Rigid-Body Transformations
  • Rotations and rigid bodies
  • About 8 minutes to read

A number such as “3.2 m” means nothing until you say 3.2 m along which axes, from which origin. A robot has many frames at once: the world, the wheel odometry origin, the robot body, and every sensor. This lesson fixes the language used in the rest of the module and in the SLAM and UAV tracks.

Learning objectives

After this lesson, you should be able to:

  • Define a right-handed coordinate frame and the pose of one frame expressed in another.
  • Name the standard frames of a mobile robot or UAV and the transforms between them.
  • Read the notation TAB and pA so that “expressed in” and “frame of” are never confused.
  • Distinguish the active view (move the point) from the passive view (change the frame).

Introduction and motivation

A LiDAR reports a wall 4 m ahead of the LiDAR. The planner needs to know where that wall is in the map. The mapping bug that hides for weeks (a mirrored map, a map that rotates when the robot turns) is nearly always a frame mistake: the right numbers in the wrong frame. Getting the vocabulary exact is the cheapest defence.

The intuition

Think of each frame as a pair of rulers glued at right angles, planted somewhere. The same arrow in space has different coordinates when measured against different rulers, but the arrow itself is unchanged. A pose says how the second pair of rulers sits relative to the first: how far the origin is shifted and how much the axes are turned.

A frame tree for a mobile robotA tree of coordinate frames: world or map at the root, odometry below it, then the robot base, then the LiDAR and the camera mounted on the base. Each arrow is a rigid transform that is known or estimated.map / world W odom O base_link B lidar L camera C SLAM correctionwheel odometryfixed mountfixed mount
Frames form a tree: each link is a transform. The world to base transform changes every instant; the base to sensor transform is fixed.

Interactive figure. A robot frame with forward and left axes rotated by a heading angle, and an arrow to a target. The readout gives the coordinates in the world and in the robot frame, and a plain-English description. This figure needs JavaScript to be interactive.

Rotate the robot heading and move the target. The arrow d is the same physical vector; its coordinates in the world frame and in the robot frame are different numbers because the rulers differ.

Geometric and physical interpretation

Geometric view. A frame is an origin plus an orthonormal, right-handed set of axes (x forward, y left, z up is the common robotics convention, ROS REP-103). Right-handed means x × y = z: curl the fingers of the right hand from x to y and the thumb gives z. Physical view. The world frame is fixed to the map; the base frame is fixed to the robot body and moves with it; a sensor frame is fixed to the sensor housing. Camera optical frames often use a different convention (x right, y down, z forward), so a fixed rotation links them to the body frame.

The mathematics

{A}, {B}
coordinate frames: an origin and three orthonormal axes.
ᴬp
the coordinates of point p expressed in frame A (a column vector).
TAB
the pose of frame B in frame A: it converts coordinates from B to A, ᴬp = TAB ᴮp.
RAB, tAB
the rotation and translation parts of TAB; tAB is the origin of B expressed in A.

Pose of one frame in another

ᴬp = RAB ᴮp + tAB

What it means. The columns of RAB are the axes of B written in A, and tAB is the position of the origin of B in A. Rotate the B-coordinates into A orientation, then add the offset between origins.

Reading the notation

TAB maps B-coordinates into A-coordinates      TAB TBC = TAC

What it means. The inner letters match and drop out: A←B then B←C gives A←C. If the inner letters do not match, the product is a bug.

A frame is an origin plus right-handed orthonormal axes. TAB is the pose of B in A and converts B-coordinates to A-coordinates. Inner subscripts must match when composing.

Step-by-step derivation: where the formula ᴬp = R ᴮp + t comes from

  1. Let frame B have origin t = t_AB (written in A) and axes b₁, b₂, b₃ (written in A as unit vectors).
  2. A point with B-coordinates ᴮp = (p₁, p₂, p₃) is, by definition, t + p₁b₁ + p₂b₂ + p₃b₃: start at B's origin and move along B's axes.
  3. Stack the axes as columns, R_AB = [b₁ b₂ b₃]. Then p₁b₁ + p₂b₂ + p₃b₃ = R_AB ᴮp (a matrix times a vector is a combination of its columns, Module 2).
  4. So the point in A is ᴬp = R_AB ᴮp + t_AB.

Orthonormality. The columns are unit and mutually perpendicular, so R_ABᵀ R_AB = I, and the entry (R_AB)ᵢⱼ = aᵢ · bⱼ is the dot product of axis i of A with axis j of B. Rotation matrices are therefore tables of direction cosines.

Vectors versus points. A displacement vector (such as a velocity) is unaffected by the offset t: ᴬv = R_AB ᴮv. Only points, which have a position, get the translation.

Active versus passive. “Rotate the point by θ in a fixed frame” (active) and “rotate the frame by −θ, keeping the point fixed” (passive) give the same coordinates. Be explicit about which you are doing; the two differ by transposing the matrix, the classic source of sign errors.

A worked example: base frame in the world, point in the base frame

  • Setup. A robot base frame B sits at t_WB = (2, 1) in the world W, with heading 90° (its x-axis points along world +y).
  • Axes. b₁ = (cos 90°, sin 90°) = (0, 1), b₂ = (−sin 90°, cos 90°) = (−1, 0), so R_WB = [[0, −1], [1, 0]].
  • A point 1 m ahead of the robot. ᴮp = (1, 0). Then ᵂp = R_WB ᴮp + t_WB = (0, 1) + (2, 1) = (2, 2). Sanity: the robot faces world +y, so a point 1 m ahead is 1 m in +y from (2, 1) ✓.
  • A LiDAR return. A range of 4 m at a bearing of 30° in the sensor frame gives ˢp = (4 cos 30°, 4 sin 30°) = (3.464, 2.000).
  • Vector versus point. A velocity of (1, 0) in B is R_WB(1, 0) = (0, 1) in W: 1 m/s along world y. No offset is added.

Robotics application

Mobile robots and navigation. The standard tree is map → odom → base_link → sensors. The map-to-odom link is what SLAM corrects; odom-to-base is continuous wheel odometry. See TF frames and consistency, poses and frames and frames, poses and footprints.

LiDAR and point clouds. Every point is born in the sensor frame and must be expressed in the base or map frame before registration (lesson 9 of this module).

UAVs. Common frames are the world (often ENU or NED), the body, and camera and IMU frames; confusing ENU with NED swaps axes and flips z. See UAV coordinate frames.

Manipulators. Each link carries a frame, and forward kinematics (Module 8) is a product of transforms between them.

IMU and GPS. The IMU measures in its own body frame; GPS reports in a global frame (latitude, longitude, altitude, or a local ENU); fusion needs the known transform between them.

Engineering implications and limitations

Practical rules

  • Name every variable with its frame. p_map, v_base, T_map_base: a number without a frame is a bug waiting to happen.
  • Check handedness. A left-handed frame (or a mirrored axis) makes the determinant of R equal −1 and mirrors the world. Verify det R = +1.
  • Know the convention of every library. ROS uses x forward, y left, z up for body frames and ENU for the world; aviation uses NED; camera optical frames use x right, y down, z forward.
  • Keep one source of truth for static mounts. The base-to-sensor transforms come from calibration and URDF, not from scattered constants.
  • Time matters too. A transform is valid at an instant; moving robots need the transform at the timestamp of the measurement, not the latest one.

Limits

A rigid transform assumes the frames are rigidly attached. Flexing arms, vibrating mounts and rolling shutter break that assumption; the linear algebra stays valid, but the transform becomes time-varying and must be estimated.

Common misconceptions

“A vector has one set of coordinates.”

It has one set per frame. The arrow is invariant; its coordinates are not.

“The translation part of TAB is the position of A in B.”

It is the origin of B written in A. The position of A in B is a different quantity, −RABᵀ tAB.

“Rotating the frame and rotating the point are the same matrix.”

They are inverse of each other (transposes), because moving the frame by θ moves the coordinates of a fixed point by −θ.

“Every sensor can share the robot frame.”

A sensor mounted 30 cm ahead and tilted 10° needs its own frame; ignoring the offset shifts every measurement.

Engineering takeaways

  1. A frame is an origin plus right-handed orthonormal axes; the same arrow has different coordinates in different frames.
  2. TAB gives the pose of B in A and converts B-coordinates to A-coordinates: ᴬp = RAB ᴮp + tAB.
  3. Subscripts chain like TAB TBC = TAC; inner letters must match.
  4. Vectors (displacements, velocities) rotate but do not translate; points do both.
  5. Name every quantity with its frame and check det R = +1 and the conventions of each library.

References and further reading

Primary papers and authoritative documentation.

Knowledge check

Three conceptual questions. Write an answer, then reveal the explanation. Your answers stay in your browser.

Question 1

A robot at world position (5, −1) faces the world −x direction (heading 180°). Where, in the world, is a point 2 m ahead and 1 m to its left?

Explanation

RWB = R(180°) = [[−1, 0], [0, −1]]. ᴮp = (2, 1). ᵂp = R ᴮp + t = (−2, −1) + (5, −1) = (3, −2). Check: facing −x, “ahead” is −x (to x = 3) and “left” is −y (to y = −2) ✓.

Question 2

The columns of RAB are (0, 1, 0), (−1, 0, 0) and (0, 0, 1). Check that this is a valid right-handed frame and say what rotation it is.

Explanation

The columns are unit and mutually orthogonal, and (0,1,0) × (−1,0,0) = (0·0 − 0·0, 0·(−1) − 0·0, 0·0 − 1·(−1)) = (0, 0, 1) = third column, so det = +1 and it is right-handed: a rotation by 90° about the z-axis.

Question 3

A velocity (1, 0, 0) in the sensor frame is converted with the full transform ᴬp = R ᴮp + t instead of R alone. What goes wrong?

Explanation

The translation t is added to a displacement, giving a spurious velocity of (1, 0, 0) + t. Vectors have no position, so only R applies. Homogeneous coordinates handle this automatically by giving a vector fourth component 0 (lesson 5).

What’s next

We start with the simplest frame change, a rotation in the plane. It contains every idea of 3D rotation in a form small enough to derive by hand.

Next lesson

M7-T2 — Two-Dimensional Rotations

Write and use a 2D rotation matrix, and derive its properties.

Nothing below is required to finish this lesson.