Chapter 02 · Turn the maths into robot motion
Today in the field story
One problem, then the next
The Camera-Crane Recovery finally reconnects its base, shoulder, elbow, and camera mount. Measure both links, declare joint zeros and signs, then predict three camera positions with forward kinematics before moving the cardboard arm. Record the residual instead of correcting the formula until link length, zero offset, backlash, measurement, and frame conventions have each been inspected.
- Why now
The mission can calculate its camera pose only after every rigid transform and joint convention is trustworthy.
- Ignore today
Ignore inverse solving and obstacle avoidance; today joint values are known inputs.
- Unlocks next
A forward model that can verify every inverse-kinematics candidate.
Understand
Build the physical picture first
Forward kinematics is a chain of rulers and hinges. Starting at the bolted base, every hinge turns the direction inherited by all links after it; adding each link's contribution locates the tool.
Forward kinematics, shortened to FK, maps known joint values and known robot geometry to an end-effector pose. Its input is the configuration q plus link and frame definitions. Its output must name the reference frame. FK asks 'where does this configuration put the tool?' It does not choose the configuration for a desired target.
For a two-link flat arm, link 1 points at θ1. Link 2 points at the absolute angle θ1+θ2 because the elbow rotates relative to link 1 and inherits the shoulder turn. Each link contributes a horizontal component l cos(angle) and a vertical component l sin(angle); adding the two contributions gives the tool position.
A longer serial arm follows the same ordered idea with one rigid transform per joint and link. General robotics software composes those transforms rather than writing a custom sine-cosine equation for every mechanism. The calculation remains deterministic: the same model and joint values should return the same pose.
The physical robot can disagree with its mathematical model. Link-length measurement error, joint zero offsets, backlash, flex, or a swapped sign create FK error even when code implements the equation correctly. Credible work compares predicted and measured tool positions in the same frame and unit, then reports the residual instead of hiding it.
Words you need
Name each idea precisely
- Forward kinematics
The map from joint configuration and robot geometry to tool pose.
Physical example:Shoulder and elbow angles predict where a desk-lamp bulb sits.
- Serial chain
Links and joints connected one after another from base to tool.
Physical example:base → shoulder link → elbow link → gripper.
- Joint zero offset
The difference between a sensor's reported zero and the model's physical zero.
Physical example:An encoder reads 0° while the link is actually tilted 3°.
- End effector
The robot part whose task pose is being predicted or controlled.
Physical example:A gripper jaw, welding torch, camera, or suction cup.
- Residual error
The measured difference between predicted and observed result.
Physical example:A predicted tip at (60.6,5.0) cm is measured 8 mm away.
Visual model
See the relationship
Math, one line at a time
Work through today’s relationship
Prerequisite rescue · optionalStart at zero: turns, triangles, and pose chains
A joint turn becomes a tool position only after we define the angle, split a link into horizontal and vertical parts, and follow frame order.
- θ
- theta: the amount a joint has turnedUnit: degrees (°) or radians (rad)
- cos θ, sin θ
- horizontal and vertical fractions of a turned unit linkUnit: no unit
- Tᴬ_B
- position and direction of frame B described by frame AUnit: unitless rotation + metres
A full turn is 360° = 2π rad, so 90° × π/180 = π/2 rad. π is about 3.1416.
For a 1 m link at 90°, x = 1 cos 90° = 0 m and y = 1 sin 90° = 1 m.
For several frames, follow the physical path in order. Multiply transforms only when the touching frame names match, then verify by reversing the path.
Like nested UI transforms, each child inherits its parent's transform; unlike UI, the order can move metal into an obstacle.
What are x and y for a 2 m link at 0 rad?
x = 2 cos 0 = 2 m; y = 2 sin 0 = 0 m.
For link lengths and angles ,
With unit links at , .
Predict a two-link tool position
Use l1=0.40 m, l2=0.30 m, θ1=30°, and relative elbow angle θ2=-60°.
Convert angles if coding: θ1=π/6 rad and θ2=-π/3 rad.
Find link 2's absolute angle: θ1+θ2=-30°.
Compute x=0.40 cos30° + 0.30 cos(-30°).
Using cos30°≈0.8660, x≈0.3464+0.2598=0.6062 m.
Compute y=0.40 sin30° + 0.30 sin(-30°)=0.2000-0.1500=0.0500 m.
Check maximum reach: √(x²+y²)≈0.608 m, which is below l1+l2=0.70 m.
The predicted tool point is approximately (0.606,0.050) m in the base frame.
Each downstream link inherits upstream joint rotation; use θ1+θ2 for the second link's absolute direction.
Physical examples
Where this appears in real life
Adjustable desk lamp
Two rigid bars with shoulder and elbow hinges position the bulb above a table.
The second bar's table direction includes both hinge turns, not only the elbow angle.
Excavator boom and stick
Measured boom and stick angles predict the bucket-pin position relative to the vehicle body.
Cylinder play and flex can make the real bucket differ from the ideal rigid-link prediction.
Hands-on exercise
Make the idea observable
Build a two-link cardboard arm with paper fasteners, draw a base frame, and use a protractor and ruler.
Measure both link lengths from joint centre to joint centre or tool mark.
Define angle-zero direction, positive rotation, and base-frame units.
Choose three angle pairs including one negative relative elbow angle.
Calculate each predicted tip coordinate before positioning the arm.
Set the arm with a protractor and mark the measured tip coordinate.
Calculate x error, y error, and Euclidean position residual for every trial.
Change one model parameter only—such as a measured link length or zero offset—and show whether the residual improves.
Small angle or length errors can grow into visible tool error, especially when links are long or nearly aligned.
Three trials include predicted pose, measured pose, residual with units, and one justified model correction.
Build today
Extend the browser notebook into a two-link arm visualizer with frame composition, forward kinematics, and a bounded numerical IK trace.
Evidence to save
DONE when a 60–120 second uncut “Forward kinematics for a serial arm” demo links to its command, logs or plots, result count, and honest failure note.
Common mistakes
Catch the wrong mental model
Using θ2 as the second link's world angle.
For a relative revolute elbow, use the inherited absolute angle θ1+θ2.
Mixing link lengths in centimetres with output expected in metres.
Convert all geometry to one declared unit before calculation.
Reporting only the predicted point without a frame.
State that the output is expressed in the chosen base frame and define its axes.
Calling a measured mismatch a formula failure immediately.
Inspect calibration, zero offsets, backlash, flex, signs, measurement uncertainty, and frame conventions.
Job connection
How this becomes employable evidence
Robot bring-up and application engineers compare encoder joint states with expected tool poses. They use FK to validate model geometry, joint signs, zero offsets, and frame conventions before motion planning or calibration acceptance.
Relevant target roles
- Robotics Deployment, Integration & Validation Engineer
- Robotics Application / ROS 2 Integration Engineer
- Robotics Software Engineer — ROS 2 / AMR
Chapter 02 interview drill
Interview questions: Forward kinematics for a serial arm
Practise a 60–90 second answer: define the idea, connect it to a physical robot, state assumptions, frames, and units when relevant, then finish with the failure signal or evidence you would inspect.
Primary interview scenario
For a two-link arm, why is the second link angle θ1+θ2? List four reasons measured tool position may disagree with correct FK code.
Answer shape: clarify the situation → trace the physical and software path → test the most likely boundaries → name the evidence that would confirm the result.
Technical follow-up questions
Q1What are FK's inputs and output?
Joint configuration plus robot geometry/frame conventions map to an end-effector pose in a named frame.
Q2If both links are 1 m and θ1=0°, θ2=90°, where is the tip?
The tip is at (1,1) m in the base frame: the first link reaches (1,0), then the second link points along positive y.
Q3Can two different joint configurations produce the same tool position?
Yes. FK is single-valued from q to pose, but the inverse map can have multiple solutions.