Coordinate Frames
If you tell a friend sitting across a table to 'move the coffee mug two inches to the left,' you immediately hit a classic robotics bug: your left isn't their left. Robots have the exact same problem across every camera, wheel, and gripper mounted on their body.
Core ideas covered in this module
- Local vs. global coordinate frames
- 2D translation & heading
- Visual 2×2 rotation matrices
Why one global grid is never enough
A room has a convenient origin — maybe one corner of the lab floor. That's great for placing tables and charging docks, but terrible for a wrist camera trying to line up with a bolt. The camera only knows what's in front of its own lens: 'the bolt is 12 cm straight ahead and 3 cm to my right.'
So instead of forcing every sensor to do mental gymnastics against the corner of the room, we attach a local coordinate frame — an origin point plus a pair of perpendicular axes (Red for X, Green for Y) — directly to each part that cares about its own point of view.
Reading a 2×2 rotation matrix without memorizing formulas
Rotation matrices look intimidating when they're introduced as tables of sines and cosines. There's a much simpler way to read one: its columns are literally just the coordinates of the robot's local X and Y axes drawn inside the room.
If the robot turns by angle θ, its forward X axis points to (cos θ, sin θ), and its sideways Y axis (90° counterclockwise) points to (-sin θ, cos θ). Stack those two arrows side-by-side and you've built the 2×2 rotation matrix from scratch.
Interactive lab
Coordinate Frames & Visual 2×2 Rotation Lab
Canvas / SVG· LiveClick or drag anywhere in the room to move Target P. Switch between Room and Robot POV to see the same physical geometry from both perspectives.
2×2 Rotation Matrix = Where the Axes Point
Two ways to read the same geometry
Notice what happens when you switch to Robot Local Frame: the robot stops moving on your screen, and the entire room rotates around it instead. Nothing changed physically — the distance and angle between the robot and the cone are identical — we just changed whose eyes we're looking through.
To convert a point from the room into the robot's local frame, we first subtract the robot's position (shifting the origin onto the robot) and then project onto the robot's X and Y axis vectors using the transpose of that rotation matrix.
2×2 rotation matrix as axis columns
R(θ) = [ cos θ -sin θ ; sin θ cos θ ] and p_robot = R(θ)ᵀ · (p_world - t_robot)
Column 1 is where local X points in the world; Column 2 is where local Y points. Multiplying by Rᵀ projects any world offset onto those two local axes.
A mobile robot is parked at the world origin (0, 0) facing straight along the world +Y axis (heading θ = 90°). What is the first column of its 2×2 rotation matrix?
Wrist-camera policies in robot learning almost always predict motions in the camera or gripper's local frame rather than room coordinates, because 'move 2 cm closer to the mug' means the same thing no matter where the table sits in the room.
Hands-On Python Notebook
02 · Coordinate Frames & 2×2 Rotation Matrix Lab
Write world_to_robot() and robot_to_world() transforms in NumPy and plot side-by-side Room Frame vs. Robot Local Frame views.
Try this on your own inside the notebook
- Verify R(θ).T @ R(θ) equals the 2×2 identity matrix
- Transform 5 local LiDAR obstacle points into room coordinates
In Google Colab, use File → Save a copy in Drive to keep your own edits and notes. Or download the files directly:
uvx marimo edit --sandbox notebooks/course-1/02_coordinate_frames_rotations.pyWrap up this module
Saved automatically in your browser profile so you can pick up right where you left off.