Skip to content
AI360Xpert
Beta
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).

1. Why Frames Matter

A single object has completely different coordinates depending on the observing frame.
A single object has completely different coordinates depending on the observing frame.

A physical object in space does not possess an inherent set of numbers; its coordinates depend entirely on the reference frame used to observe it. An overhead camera {C}\{C\} observes a coffee mug at (xC,yC)=(0.10 m,0.40 m)(x_C, y_C) = (0.10\text{ m}, 0.40\text{ m}). The robot arm base {B}\{B\} requires coordinates relative to its own shoulder at (xB,yB)=(1.20 m,0.40 m)(x_B, y_B) = (1.20\text{ m}, 0.40\text{ m}). Coordinate transformations bridge this perceptual divide.

2. Pure Translation

Pure translation shifts the coordinate origin by vector addition.
Pure translation shifts the coordinate origin by vector addition.

When two coordinate frames {A}\{A\} and {B}\{B\} share identical axis orientations, converting coordinates requires only vector addition. If the origin of {B}\{B\} sits at offset dB/A=(xBA,yBA)d_{B/A} = (x_{BA}, y_{BA}) relative to {A}\{A\}, the position of point PP transforms as:

pA=pB+dB/Ap^A = p^B + d_{B/A}

Translation shifts the origin without changing the direction or scaling of the coordinate axes.

3. Pure Rotation

The rotation matrix projects rotated coordinate axes onto fixed base axes.
The rotation matrix projects rotated coordinate axes onto fixed base axes.

When frames share an origin but differ by planar rotation angle θ\theta, coordinates transform via the Special Orthogonal group SO(2)SO(2) rotation matrix:

R=[cos⁡θ−sin⁡θsin⁡θcos⁡θ]R = \begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix}

Because rotation preserves lengths and angles, RR is strictly orthonormal: its columns are orthogonal unit vectors, its determinant equals 11, and its inverse equals its matrix transpose: R−1=RTR^{-1} = R^T.

4. Homogeneous Coordinates

Homogeneous coordinates bundle rotation and translation into one matrix multiplication.
Homogeneous coordinates bundle rotation and translation into one matrix multiplication.

Translation is additive (p+dp + d) while rotation is multiplicative (RpR p). To combine both into a single linear matrix operation, robotics uses homogeneous coordinates in the Special Euclidean group SE(2)SE(2):

T=[Rp01]=[r11r12xr21r22y001]T = \begin{bmatrix} R & p \\ 0 & 1 \end{bmatrix} = \begin{bmatrix} r_{11} & r_{12} & x \\ r_{21} & r_{22} & y \\ 0 & 0 & 1 \end{bmatrix}

Appending a scale factor of 11 to position vectors allows translation and rotation to be executed simultaneously: p~A=TABp~B\tilde{p}^A = T_A^B \tilde{p}^B.

5. Camera to Base: Worked Example

Camera detection (0.10, 0.40) transforms to base frame coordinates (1.20, 0.40).
Camera detection (0.10, 0.40) transforms to base frame coordinates (1.20, 0.40).

Consider a camera {C}\{C\} mounted at (x,y)=(0.80 m,0.50 m)(x, y) = (0.80\text{ m}, 0.50\text{ m}) relative to base {B}\{B\}, tilted by θ=−90∘\theta = -90^\circ (cos⁡(−90∘)=0\cos(-90^\circ) = 0, sin⁡(−90∘)=−1\sin(-90^\circ) = -1). The homogeneous transform matrix is:

TBC=[010.80−100.50001.00]T_B^C = \begin{bmatrix} 0 & 1 & 0.80 \\ -1 & 0 & 0.50 \\ 0 & 0 & 1.00 \end{bmatrix}

Transforming the camera detection pC=[0.10,0.40,1]Tp^C = [0.10, 0.40, 1]^T:

[xByB1]=[0(0.10)+1(0.40)+0.80−1(0.10)+0(0.40)+0.501]=[1.20 m0.40 m1]\begin{bmatrix} x_B \\ y_B \\ 1 \end{bmatrix} = \begin{bmatrix} 0(0.10) + 1(0.40) + 0.80 \\ -1(0.10) + 0(0.40) + 0.50 \\ 1 \end{bmatrix} = \begin{bmatrix} 1.20\text{ m} \\ 0.40\text{ m} \\ 1 \end{bmatrix}

Distance from base is r=1.202+0.402≈1.265 mr = \sqrt{1.20^2 + 0.40^2} \approx 1.265\text{ m}, safely inside the arm's reachable envelope.

6. Inverse Transform Round-Trip

The inverse transformation matrix maps base coordinates back to camera sightings.
The inverse transformation matrix maps base coordinates back to camera sightings.

To verify mathematical consistency, we construct the analytical inverse transform:

(TBC)−1=[RT−RTp01]=[0−10.5010−0.80001.00](T_B^C)^{-1} = \begin{bmatrix} R^T & -R^T p \\ 0 & 1 \end{bmatrix} = \begin{bmatrix} 0 & -1 & 0.50 \\ 1 & 0 & -0.80 \\ 0 & 0 & 1.00 \end{bmatrix}

Multiplying by the calculated base point pB=[1.20,0.40,1]Tp^B = [1.20, 0.40, 1]^T:

xC=0(1.20)−1(0.40)+0.50=0.10 m,yC=1(1.20)+0(0.40)−0.80=0.40 mx_C = 0(1.20) - 1(0.40) + 0.50 = 0.10\text{ m}, \quad y_C = 1(1.20) + 0(0.40) - 0.80 = 0.40\text{ m}

The round trip exactly recovers the original camera coordinates.

7. Kinematic Chains and Transform Trees

Multiplying transformation matrices composes frames along a kinematic chain.
Multiplying transformation matrices composes frames along a kinematic chain.

Robots consist of serial links connected by moving joints. Consecutive frames multiply together to form compound transformations:

T0H=T01⋅T12⋅T2HT_0^H = T_0^1 \cdot T_1^2 \cdot T_2^H

Adjacent matching superscripts and subscripts cancel out across the product chain. In ROS architectures, the tf2 library maintains this dynamic directed tree of relative coordinate transformations across the entire robot.

8. Extension to 3D Space: SE(3)

3D spatial transforms expand to 4x4 matrices representing 6 degrees of freedom.
3D spatial transforms expand to 4x4 matrices representing 6 degrees of freedom.

In full 3D space, rigid bodies possess 6 degrees of freedom: 3 translations (x,y,z)(x, y, z) and 3 rotations (roll, pitch, yaw). The transformation matrix expands to a 4×44\times 4 matrix in SE(3)SE(3):

T=[R3×3p3×101×31]T = \begin{bmatrix} R_{3\times 3} & p_{3\times 1} \\ 0_{1\times 3} & 1 \end{bmatrix}

The 3×33\times 3 submatrix R∈SO(3)R \in SO(3) captures spatial orientation without changing distances between points.

9. Optical vs Body Frame Conventions

Robotics body frames and camera optical frames follow different axis conventions.
Robotics body frames and camera optical frames follow different axis conventions.

Coordinate conventions differ between computer vision and robotics standards. Under ROS REP-103, mobile robots use: +X+X forward, +Y+Y left, and +Z+Z up. Under computer vision standards (OpenCV), camera optical frames use: +Z+Z forward along the optical viewing axis, +X+X right across the image sensor, and +Y+Y down. Transforming vision data requires an explicit static rotation: RbodyopticalR_{\text{body}}^{\text{optical}}.

10. Where It Breaks

Extrinsic calibration errors displace commanded targets into empty air.
Extrinsic calibration errors displace commanded targets into empty air.

Transformations depend strictly on accurate physical calibration. If the camera mounting bracket shifts by 12∘12^\circ or its position offset drifts by 15 cm15\text{ cm}, the transformation matrix TBCT_B^C projects the mug to (1.38 m,0.15 m)(1.38\text{ m}, 0.15\text{ m}). The robot arm executes its motion flawlessly according to its internal math, yet its mechanical fingers close on empty air 25 cm25\text{ cm} away from the physical target.

The Quick Version

  • Coordinates are relative constructs; physical targets require declared reference frames.
  • Pure translation shifts origins via vector addition when axes align.
  • Planar rotation matrices belong to orthonormal SO(2) with transpose inverses.
  • Homogeneous coordinates combine rotation and translation into single matrix multiplications.
  • Camera sightings map to robot base coordinates using homogeneous SE(2) matrices.
  • Analytical inverse transforms compute reverse coordinate mappings without matrix inversion.
  • Serial robot arms compose frames by chaining consecutive transform multiplications.
  • Spatial 3D rigid body motion expands to 4x4 matrices in SE(3).
  • Camera optical conventions differ from robotics REP-103 body axis standards.
  • Extrinsic mounting errors displace commanded targets into empty space or collisions.