Skip to content
AI360XpertBeta
Physical AI & Robotics

Visual explainer

Coordinate Frames and Transforms

Convert coordinates across sensor and robot frames using homogeneous transformation matrices in SE(2) and SE(3).

Coordinates describe a point relative to a declared frame. A rigid transform changes that description through rotation and an origin offset, preserving physical distances. We use column vectors and write TBCT_{BC} for a map from camera frame C into base frame B; the right subscript is the input frame.

1. One Point, Two Frames

One physical point has coordinates relative to two frames.
One physical point has coordinates relative to two frames.

The mint dot is one physical point P. Base x points right and base y up. The camera frame is rotated −90° in the plane, so camera x points down and camera y right. In this synthetic fixture its origin is at (0.80, 0.50) m in B. P has coordinates (0.10, 0.40) m in C and (1.20, 0.40) m in B. Changing coordinates does not move the object. This planar C frame is a teaching frame, not a complete optical-axis convention.

2. First Align The Axes

Parallel frames convert a point by adding their origin offset.
Parallel frames convert a point by adding their origin offset.

This control case temporarily sets the camera rotation to zero while retaining offset t = (0.80, 0.50) m and local point (0.10, 0.40) m. Parallel axes allow direct addition: pB=t+pC=(0.90,0.90)p_B=t+p_C=(0.90,0.90) m. The head-to-tail path adds offset and local displacement; the dashed route is the total displacement. It uses 240 drawing units per metre. The different output is intentional: this is a different frame orientation from the main example.

3. Rotate Without Rescaling

A quarter-turn changes direction while preserving vector length.
A quarter-turn changes direction while preserving vector length.

Now isolate the main example's −90° rotation at a common origin. At 300 drawing units per metre, the vector (0.10, 0.40) becomes (0.40, −0.10). Both lengths are sqrt0.102+0.402=sqrt0.17sqrt{0.10^2+0.40^2}=sqrt{0.17} m. The dashed circular arc makes the preserved radius visible. The plot shows the numerical rotation operation in a common chart; it does not move the real target.

R( heta)=egin{bmatrix}cos heta&-sin heta\sin heta&cos hetaend{bmatrix},qquad R(-90^circ)=egin{bmatrix}0&1\-1&0end{bmatrix}.

Rotation columns are orthogonal unit axes, with determinant +1 and R−1=RTR^{-1}=R^T. Modern Robotics 3.2.1 distinguishes representing a frame from actively rotating a vector; keeping the input/output frame labels avoids mixing those interpretations.

4. Distinguish Points From Directions

Translation shifts a point but does not shift a direction vector.
Translation shifts a point but does not shift a direction vector.

The white arrow is the rotated direction (0.40, −0.10). At 200 drawing units per metre, the dashed offset moves its endpoint as a point to (1.20, 0.40). A direction receives rotation but no origin offset. Homogeneous coordinates encode this difference by appending 1 to a point and 0 to a direction:

T_{BC}=egin{bmatrix}R&t\0&1end{bmatrix},quad T_{BC}egin{bmatrix}p_C\1end{bmatrix}=egin{bmatrix}Rp_C+t\1end{bmatrix},quad T_{BC}egin{bmatrix}v_C\0end{bmatrix}=egin{bmatrix}Rv_C\0end{bmatrix}.

The planar matrix is 3×3, in SE(2). Translation is affine in ordinary coordinates; it becomes part of a linear operation in augmented homogeneous coordinates. The final coordinate is not an arbitrary scale applied to the physical scene.

5. Map Camera To Base

The camera point maps to base coordinates (1.20, 0.40).
The camera point maps to base coordinates (1.20, 0.40).

Return to the original mount and the 300-unit-per-metre spatial view. From C, camera x contributes 0.10 m down, while camera y contributes 0.40 m right. Add these rotated components to the camera origin:

T_{BC}=egin{bmatrix}0&1&0.80\-1&0&0.50\0&0&1end{bmatrix},qquad T_{BC}egin{bmatrix}0.10\0.40\1end{bmatrix}=egin{bmatrix}1.20\0.40\1end{bmatrix}.

Thus xB=0.40+0.80=1.20x_B=0.40+0.80=1.20 m and yB=−0.10+0.50=0.40y_B=-0.10+0.50=0.40 m. The same 0.40 value appears twice in the picture for different quantities: local camera y displacement and final base y coordinate. No arm, obstacle or payload model is specified, so these coordinates alone establish neither reachability nor a safe grasp.

6. Check The Reverse Map

Removing the offset and undoing rotation recovers camera coordinates.
Removing the offset and undoing rotation recovers camera coordinates.

First subtract the offset in base coordinates: (1.20,0.40)−(0.80,0.50)=(0.40,−0.10)(1.20,0.40)-(0.80,0.50)=(0.40,-0.10). Then unrotate with RTR^T, obtaining (0.10, 0.40) m. The paired plots use the same 240-unit-per-metre vector scale, with separate origins for readability.

T_{CB}=T_{BC}^{-1}=egin{bmatrix}R^T&-R^Tt\0&1end{bmatrix} =egin{bmatrix}0&-1&0.50\1&0&-0.80\0&0&1end{bmatrix}.

Multiplying by (1.20, 0.40, 1) recovers the original camera point. Negating t without rotating it is generally wrong. A round trip verifies algebraic consistency; a consistently wrong calibration can still pass it.

7. Compose Frame Maps

Composing two frame maps expresses the same point in a world frame.
Composing two frame maps expresses the same point in a world frame.

Add world frame W, aligned with B and with B located at (1, 0) m in W. The scene uses 200 drawing units per metre. The same point is now at (2.20, 0.40) m in W. Composition is TWC=TWBTBCT_{WC}=T_{WB}T_{BC}: the rightmost map acts first on pCp_C.

Here the combined rotation stays −90° and the combined origin offset is (1.80, 0.50) m. Matching intermediate frame labels make the order checkable. Matrix multiplication is associative but generally not commutative. Modern Robotics 3.3.1 develops this frame-composition and inverse convention. Moving mounts require transforms appropriate to the measurement timestamp.

8. Extend To Three Dimensions

A spatial rigid transform maps all three coordinates with one rotation and offset.
A spatial rigid transform maps all three coordinates with one rotation and offset.

The paired charts use the same oblique projection: 100 drawing units per metre along x and z, with y projected 50 units right and 40 up. Their origins are separated for layout; projected screen lengths are not Euclidean 3D distances.

Extend the example to pC=(0.10,0.40,0.20)p_C=(0.10,0.40,0.20) m, rotation −90° about z, and t=(0.80,0.50,0.30)t=(0.80,0.50,0.30) m. Rotation gives (0.40, −0.10, 0.20), then translation gives pB=(1.20,0.40,0.50)p_B=(1.20,0.40,0.50) m. The transform is now 4×4: a 3×3 rotation, a three-component offset and bottom row (0, 0, 0, 1). Rigid pose has six degrees of freedom; the nine rotation entries are constrained, not nine independent angles.

9. Declare Axis Conventions

Body and optical frames assign different names to physical directions.
Body and optical frames assign different names to physical directions.

This separate convention diagram is qualitative, not the earlier planar mount. ROS REP-103 specifies a right-handed body convention: x forward, y left and z up. Its optical suffix frame uses z forward, x right and y down. Physical forward points the same way in both triads despite receiving different axis names.

For an aligned forward-facing camera with a coincident origin, optical-to-body coordinates map as (xB,yB,zB)=(zC,−xC,−yC)(x_B,y_B,z_B)=(z_C,-x_C,-y_C). Actual mounts also require their measured extrinsic rotation and offset. A naming convention alone does not calibrate a camera.

10. Where It Breaks

A 0.15-metre offset error shifts the mapped target by 0.15 metres.
A 0.15-metre offset error shifts the mapped target by 0.15 metres.

Return to the original planar fixture. Keep R and the measured camera point correct, but let the software use offset (0.95, 0.50) m instead of (0.80, 0.50). The wrong transform outputs (1.35, 0.40) m rather than (1.20, 0.40) m. The x-only error is exactly 0.15 m. The final picture zooms to 1,200 drawing units per metre, so that miss spans 180 drawing units.

The real point remains fixed; only the commanded target is wrong. This demonstrates one translation calibration error, not a predicted result of an unspecified angular error or a guaranteed collision. An inverse made from the same incorrect transform still round-trips correctly. Calibration needs external physical checks beyond consistent matrix arithmetic.

The Quick Version

  • Every coordinate needs a declared frame.
  • Parallel axes permit direct addition of the origin offset.
  • Rigid rotation preserves physical lengths and angles.
  • Homogeneous points receive translation; direction vectors do not.
  • Rotate local coordinates before adding the destination-frame offset.
  • Inversion subtracts the offset and then undoes rotation.
  • Compose maps with the rightmost transform acting first.
  • Spatial transforms use constrained rotation matrices and three-component offsets.
  • Optical and body frames name physical directions differently.
  • Consistent algebra cannot prove correct physical calibration.