Stage 01 · Lesson 03/12

Math for Robotics · Lesson 03

Coordinate Systems

Est. 30–40 min

Why

Why “forward” is meaningless without a named frame

This lesson teaches you to draw and name right-handed frames, pick units, and express the same point in two frames that only differ by a shift.

Concept

The big idea: origin + oriented axes = a frame

  • A coordinate system (frame) has an origin and oriented axes.
  • Right-handed frames: x, y, z follow the right-hand rule (common in robotics).
  • 2D lab sketch: +x right, +y up (math). Screens often flip y; many robots use +z up.
  • Always name frames: {world}, {base}, {tool}, {camera}.
  • Units: metres in serious stacks; hobby code often uses mm — pick one and stick to it.
NoteSimplification: we stay Euclidean (no curved manifolds).

How it works

How it actually works, step by step

  1. Pick an origin

    A nail in the desk, the robot base bolt pattern, the camera optical centre — mark it.

  2. Pick axis directions

    Decide +x, then +y (or +z up). Use the right-hand rule so everyone agrees.

  3. Name the frame

    Write {base} or {camera} on the sketch. Unnamed arrows cause night-shift bugs.

  4. Express a point

    Coordinates are always relative to a frame. “P = (3, 1.5) m in {world}” is complete; “(3, 1.5)” alone is not.

Visual

Visualise it: move and rotate a frame

Move and rotate frame F relative to world. A fixed local point maps to different world coordinates.

Interactive · Coordinate-frame manipulator

XwYwFrame F

Point in world

(95.0, 77.7)

p_world = origin + R(θ) · p_local

Worked example

Worked example: same point, two platforms

Point P is at (3.0, 1.5) m in {world}. Frame {B}’s origin sits at (2.0, 0) m in world, axes parallel. Then in {B}, P is (1.0, 1.5) m.

Code lab

Code lab: map a point between frames

frames_map.py · Python
"""Stage 1 L03 — express the same point in world and in a shifted frame."""
# World origin at platform centre. Frame B is 2 m along +x (towards Platform B).
# Point P is at (3.0, 1.5) m in world.

px_w, py_w = 3.0, 1.5
ox_b, oy_b = 2.0, 0.0  # origin of B in world
# If B is only translated (no rotation): p_B = p_W - o_B
px_b = px_w - ox_b
py_b = py_w - oy_b

print("Point P in world: ({:.1f}, {:.1f}) m".format(px_w, py_w))
print("Origin of B in world: ({:.1f}, {:.1f}) m".format(ox_b, oy_b))
print("Same point P in B:    ({:.1f}, {:.1f}) m".format(px_b, py_b))
print("Check: world = B_origin + p_B → ({:.1f}, {:.1f})".format(ox_b + px_b, oy_b + py_b))

Expected output

Point P in world: (3.0, 1.5) m
Origin of B in world: (2.0, 0.0) m
Same point P in B:    (1.0, 1.5) m
Check: world = B_origin + p_B → (3.0, 1.5)

Real world

Frames you will name on a robot

Coordinate measuring machine used to measure precise part dimensions.
A coordinate measuring machine (CMM) is literally a high-precision coordinate system for parts. Robots need the same clarity: named frames and known units.Photo: National Institute of Standards and Technology · Public domain (US government work) · Source: Wikimedia Commons · resized, converted to WebP
  • {world} / map frame on a mobile robot
  • {base} bolted to the arm pedestal
  • {tool} / {ee} at the gripper
  • {camera} at the sensor optical frame

Mistakes

Common mistakes and confusions

Hardware & safety

Hardware lab and safety notes

Build a desk frame you can touch: a sheet of graph paper taped to the table with the origin marked in one corner. This is your {world} for the rest of Stage 1.

  • Mark +x along the long edge and +y along the short edge; +z points up (right-hand rule).
  • Place a second sheet (frame {B}) 20 cm along x, edges parallel. Put a coin on it and measure it in both frames.
  • Write units on every number (cm or m). ROS uses metres (REP 103).

Debugging

Debugging: when it doesn’t work

Symptom → likely cause → fix
SymptomLikely causeFix
Converted point is off by exactly the frame offsetAdded o_B instead of subtractingp_B = p_W − o_B (axes parallel)
Answer is 1000× offMixed mm and mPick one unit, convert at input
z comes out negative when it should be upLeft-handed axesUse the right-hand rule: x × y = z
Two people get different answersFrame not named or origin not markedWrite {frame} and origin on the page
NoteChange one thing at a time. Most Stage 1 bugs are units (degrees vs radians, mm vs m), order of multiplication, or a frame that was never named.

Think

Think about it

Think

A coworker says “the object is at x=0.2”. What three clarifying questions should you ask?

Experiment

Try it in the lab: name three frames

Experiment

Name three frames

You will need

  • Desk or table
  • Notebook
  • Optional: sticky notes

Steps

  1. Pick a desk corner as {world} origin. Draw +x along the long edge, +y along the short edge.
  2. Place a water bottle. Measure its (x,y) in cm in {world}.
  3. Define {B} as another corner. Re-express the bottle in {B}.
  4. Label sticky notes: {world}, {B}, bottle.

Interactive · Coordinate-frame manipulator

XwYwFrame F

Point in world

(95.0, 77.7)

p_world = origin + R(θ) · p_local

The bottle did not move — only the numbers changed with the frame.

Knowledge check

Check your understanding

Knowledge check

1. A coordinate frame needs at least…

2. Right-handed frames are common because…

3. Best habit when writing a point?

4. If {B} is only translated from world by o_B, then p_B = …

Practice quiz

Loading practice quiz…

Mini assignment

Hands-on assignment

Mini assignment

Frame legend

Draw a one-page legend for a desk-scale robot cell: {world}, {base}, {tool}, {camera} with origins and axis directions.

Deliverables

  • Annotated sketch
  • Unit choice stated

Do this, step by step

  1. Tape graph paper and mark {world}. Place frame {B} with origin at (20, 0) cm, axes parallel.
  2. Put a coin at any spot. Measure it in {world} and in {B}.
  3. Check: o_B + p_B should equal p_W. Note any error in mm.
  4. Edit frames_map.py with your numbers and confirm the script agrees.

Stuck? Hints, one at a time

NoteTry the task first. Read one hint, try again, and only then read the next one.
  1. Hint 1: Measure from the marked origin, not from the paper edge.
  2. Hint 2: With parallel axes, only subtraction is needed: p_B = p_W − (20, 0).
  3. Hint 3: An error of 1–2 mm is normal from ruler reading; 20 cm means you used the wrong origin.

Challenges (pick by level)

  • 🟢 Easy: Add frame {C} at (0, 15) cm and express the coin in it.
  • 🟡 Medium: Repeat with all positions in metres and check the script still agrees.
  • 🟠 Hard: Turn {B} by 90° on the desk. Why does subtraction alone now fail? (Lesson 7 fixes this.)

Next step

Next, Lesson 4: 2D Vectors — the arrows between those points. Related: ROS frame conventions in Stage 10 — ROS 2.

Sources

Self-attested for now — keep artifacts in your lab notebook.

Complete

Today's goal

0 of 1 done today

0-day streak
Daily goal:lessons, quizzes or assignments a day

Mark this lesson complete when you have worked the experiment, knowledge check, and assignment (even roughly).

Stuck somewhere?

Ask a doubt about this lesson

Saved with this lesson's id and your email so we can reply. Privacy · or email contact@aihubstation.in