Stage 01 · Lesson 11/12

Math for Robotics · Lesson 11

Math → Robot Connection

Est. 35–45 min

Why

Why joint space and task space must stay friends

Concept

The big idea: angles in, tip pose out (FK intuition)

  • Joint space: the vector of joint angles (and maybe prismatic lengths).
  • Task space: tip position (and orientation) in a Cartesian frame.
  • FK: given joints, compute tip — usually unique and straightforward (trig + transforms).
  • IK: given tip, find joints — may have 0, 1, or many solutions (later stages).
  • You already have the pieces: angles, trig, vectors, frames, R, t, H.

How it works

How it actually works, step by step

  1. Read joint angles

    From encoders or from your commanded setpoints (radians internally).

  2. Build each link transform

    Using length and joint angle — planar FK or a small H per joint.

  3. Compose base → tip

    Multiply along the chain (frame tree).

  4. Read task-space pose

    Tip origin and orientation in {base} or {world}.

Visual

Visualise it: pose from joint configuration

Change the pose controls and connect what you see to joint-space commands versus tip position in space.

Interactive · Robot pose / transformation demo

Tip (x, y)

(152.1, 75.4)

Tip yaw

-5.0°

Simplification: planar 2R arm. Each joint adds a rotation; tip pose is the product of link transforms — the same idea as homogeneous chains on a 6DOF arm.

Worked example

Worked example: 2DOF FK table

L1=15 cm, L2=12 cm. Several (q1,q2) pairs map to different tip locations — see the code lab table.

Code lab

Code lab: joint space → tip table

fk_joint_space.py · Python
"""Stage 1 L11 — joint space → task space (planar 2DOF FK table)."""
import math

L1, L2 = 0.15, 0.12
configs = [(0, 0), (30, 0), (30, 45), (90, -60)]

print("q1°  q2°  |  tip_x cm  tip_y cm")
print("-" * 40)
for q1d, q2d in configs:
    q1, q2 = math.radians(q1d), math.radians(q2d)
    x = L1*math.cos(q1) + L2*math.cos(q1+q2)
    y = L1*math.sin(q1) + L2*math.sin(q1+q2)
    print(f"{q1d:3d}  {q2d:3d}  |  {x*100:7.2f}   {y*100:7.2f}")

print()
print("Joint space = the angles you command.")
print("Task space  = where the tip actually is (here in cm).")

Expected output

q1°  q2°  |  tip_x cm  tip_y cm
----------------------------------------
  0    0  |    27.00      0.00
 30    0  |    23.38     13.50
 30   45  |    16.10     19.09
 90  -60  |    10.39     21.00

Joint space = the angles you command.
Task space  = where the tip actually is (here in cm).

Real world

Industrial arms speaking maths

Industrial ABB robot arm with a gripper in a lab or factory setting.
Industrial arms constantly convert between joint angles (motors) and Cartesian tool poses (the job). That bridge is FK/IK.Photo: Peter17 · CC BY 2.5 · Source: Wikimedia Commons · resized, converted to WebP
Industrial robots perched above a welding cell.
Welding paths are planned in task space; the controller tracks them using joint-space commands under the hood.Photo: Phasmatisnox · CC BY 3.0 · Source: Wikimedia Commons · resized, converted to WebP

Mistakes

Common mistakes and confusions

Hardware & safety

Hardware lab and safety notes

Two potentiometers (or two servos) on a cardboard two-link arm turn this lesson into a real joint-space → task-space machine: knobs are joint space, the pen tip is task space.

  • Build on Lesson 2: pot 1 → A0 (q1), pot 2 → A1 (q2), both between 5 V and GND.
  • Print q1, q2 and the FK tip with L1 = 15 cm, L2 = 12 cm, like fk_joint_space.py.
  • If you use servos instead, give them a separate 5–6 V supply and common ground.

Debugging

Debugging: when it doesn’t work

Symptom → likely cause → fix
SymptomLikely causeFix
Tip table doesn't match the scriptLink 2 angle not added to q1Link 2 absolute angle = q1 + q2
Commanded (x, y) into a joint APIMixed task space and joint spaceJoint APIs take angles; run IK first
IK returns nothingTarget is outside reach (> L1 + L2)Check |target| ≤ L1 + L2 before IK
Arm picks the “other” elbowTwo IK solutions existChoose elbow-up or elbow-down explicitly
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

Why is FK usually easier than IK for the same arm?

Experiment

Try it in the lab: FK worksheet

Experiment

FK worksheet

You will need

  • fk_joint_space.py
  • Notebook

Steps

  1. Reproduce two rows of the table by hand with a calculator.
  2. Change L2 in the script and predict whether reach grows or shrinks.
  3. Mark which configs look “elbow up” vs “elbow down” on a sketch.

Interactive · Robot pose / transformation demo

Tip (x, y)

(152.1, 75.4)

Tip yaw

-5.0°

Simplification: planar 2R arm. Each joint adds a rotation; tip pose is the product of link transforms — the same idea as homogeneous chains on a 6DOF arm.

Hand calc and script should match within ~0.1 cm.

Knowledge check

Check your understanding

Knowledge check

1. Joint space means…

2. FK maps…

3. IK may have…

4. This stage’s tools that build FK include…

Practice quiz

Loading practice quiz…

Mini assignment

Hands-on assignment

Mini assignment

FK / IK postcard

One postcard: front = FK diagram (joints → tip). Back = IK warning (may fail / multi-solution).

Deliverables

  • Postcard or half-page diagram

Do this, step by step

  1. Reproduce rows 2 and 3 of the fk_joint_space.py table by hand.
  2. Add a row for q1 = 60°, q2 = −30° in the script and predict the tip first.
  3. Mark which configurations are elbow-up and which elbow-down.
  4. Make the FK / IK postcard.

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: Row 2: (15·cos30° + 12·cos30°, 15·sin30° + 12·sin30°) = (23.38, 13.50) cm.
  2. Hint 2: New row: link 2 absolute angle = 60° − 30° = 30°, so tip ≈ (7.50 + 10.39, 12.99 + 6.00) = (17.89, 18.99) cm.
  3. Hint 3: A negative q2 bends the elbow one way, positive the other — draw both to see.

Challenges (pick by level)

  • 🟢 Easy: What is the maximum reach of this arm? (27 cm.)
  • 🟡 Medium: Find two (q1, q2) pairs that reach the same tip.
  • 🟠 Hard: Write a 2-link IK using the law of cosines and check FK(IK(p)) ≈ p.

Next step

Next, Lesson 12: Capstone — Locate & Move puts everything together. Related: full IK in Stage 8 — Kinematics & IK.

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