Forward Kinematics: How Robots Calculate Where the Hand Is
Imagine you’re holding a long stick with your arm straight out.
If you know:
- How long your upper arm is
- How long your forearm is
- The angle of your shoulder
- The angle of your elbow
You can figure out exactly where your hand is, right?
That’s forward kinematics. Robots do the same thing — with math.
The Simple Version (2 Joints)
Let’s start with a very simple robot arm:
Hand (x, y)
|
Link 2 (length = L2)
|
Joint 2 (angle = θ2)
|
Link 1 (length = L1)
|
Joint 1 (angle = θ1)
|
Base
The question: If Joint 1 is at 30 degrees and Joint 2 is at 45 degrees, where is the hand?
Step 1: Find Where Joint 2 Is
Joint 2 is at the end of Link 1. We can find its position with simple trigonometry:
x of Joint 2 = L1 × cos(θ1)
y of Joint 2 = L1 × sin(θ1)
In plain English:
costells us how far to the rightsintells us how far up- Multiply by the link length to get the actual distance
Example:
- L1 = 10 inches
- θ1 = 30 degrees
x of Joint 2 = 10 × cos(30°) = 10 × 0.866 = 8.66 inches
y of Joint 2 = 10 × sin(30°) = 10 × 0.5 = 5 inches
So Joint 2 is at position (8.66, 5).
Step 2: Find Where the Hand Is
The hand is at the end of Link 2. But Link 2 starts at Joint 2, not at the base.
So we add Joint 2’s position to Link 2’s contribution:
x of Hand = x of Joint 2 + L2 × cos(θ1 + θ2)
y of Hand = y of Joint 2 + L2 × sin(θ1 + θ2)
Why θ1 + θ2? Because Link 2 starts at the angle of Joint 1, then adds the angle of Joint 2.
Example:
- L2 = 8 inches
- θ2 = 45 degrees
- θ1 + θ2 = 30° + 45° = 75°
x of Hand = 8.66 + 8 × cos(75°) = 8.66 + 8 × 0.259 = 8.66 + 2.07 = 10.73 inches
y of Hand = 5 + 8 × sin(75°) = 5 + 8 × 0.966 = 5 + 7.73 = 12.73 inches
The hand is at position (10.73, 12.73).
The Full Formula (All Joints)
For a robot with any number of joints, the formula is:
x = L1×cos(θ1) + L2×cos(θ1+θ2) + L3×cos(θ1+θ2+θ3) + ...
y = L1×sin(θ1) + L2×sin(θ1+θ2) + L3×sin(θ1+θ2+θ3) + ...
Pattern: For each link, add up all the angles before it, then use cos for x and sin for y.
This works for 2 joints, 6 joints, or 100 joints. The computer just keeps adding terms.
Why This Matters
In Factories
A welding robot knows:
- Joint 1: 45 degrees
- Joint 2: 30 degrees
- Joint 3: -15 degrees
- Joint 4: 60 degrees
- Joint 5: 0 degrees
- Joint 6: 90 degrees
It calculates: The welding tip is at (2.3, 1.7, 0.5) meters.
Now it knows exactly where it’s welding.
In Surgery
A surgical robot knows:
- The angles of all 7 joints
It calculates: The scalpel tip is at position (X, Y, Z) inside the patient’s body.
The surgeon sees this position on a screen and knows exactly where the robot is cutting.
In Space
The International Space Station’s robot arm (Canadarm) has 7 joints. It uses forward kinematics to know where the hand is — while holding equipment that weighs thousands of pounds.
The Math Has a Name: The Denavit-Hartenberg Method
Real robots use a standard method called D-H parameters (named after two engineers). It’s just a way to organize the math so every robot uses the same format.
Each joint needs 4 numbers:
| Number | What It Means | Example |
|---|---|---|
| a | How long the link is | Upper arm = 12 inches |
| α | How twisted the joint is | Usually 0 or 90 degrees |
| d | How far apart the joints are | Shoulder to elbow = 12 inches |
| θ | The joint angle (the part that changes) | Elbow bends from 0 to 180 degrees |
The magic: Once you have these 4 numbers for each joint, a computer can calculate the hand position automatically.
Common Questions
Q: Does forward kinematics have multiple answers? No. Given the joint angles, there’s only one possible hand position. That’s why it’s “forward” — the answer is certain.
Q: What if I only know some joint angles? You can still calculate part of the position. But you need all angles to know exactly where the hand is.
Q: Can the hand reach any position? No. The hand can only reach positions within the robot’s “workspace” — the area its arm can cover. Some positions are simply too far away.
Q: Do I need to understand this math to use robots? No. The computer does all the math. But understanding the idea helps you:
- Know why robots can’t reach certain spots
- Plan better robot layouts
- Debug when things go wrong
Try It Yourself
Exercise 1: Paper and Pencil
- Draw a 2-joint robot arm on paper
- Pick two angles (like 30° and 45°)
- Use a ruler and protractor to draw the arm
- Measure where the hand ends up
- Now use the formulas above. Do you get the same answer?
Exercise 2: Simple Python
import math
def forward_kinematics(L1, L2, theta1_deg, theta2_deg):
"""Calculate hand position for a 2-joint arm"""
# Convert degrees to radians
theta1 = math.radians(theta1_deg)
theta2 = math.radians(theta2_deg)
# Calculate position
x = L1 * math.cos(theta1) + L2 * math.cos(theta1 + theta2)
y = L1 * math.sin(theta1) + L2 * math.sin(theta1 + theta2)
return x, y
# Test: L1=10, L2=8, theta1=30, theta2=45
x, y = forward_kinematics(10, 8, 30, 45)
print(f"Hand position: ({x:.2f}, {y:.2f})")
# Output: (10.73, 12.73)
Exercise 3: Build a Simple Robot Arm
Use cardboard, straws, and push pins. Make a 2-joint arm. Measure the link lengths. Move the joints and measure where the hand is. Compare with your calculations.
Key Takeaways
- Forward kinematics = angles → position
- The math is just trigonometry — cos and sin
- Each link adds to the position of the previous one
- The answer is always unique — one set of angles = one position
- Real robots use D-H parameters — a standard way to organize the math
What’s Next?
Forward kinematics is the easy direction. The hard direction is the reverse:
“I know where the hand should be. What angles get it there?”
That’s called inverse kinematics — and it’s much harder. Multiple answers, no answers, and tricky math.
We’ll cover that in the next guide.
This is part of Robot Basics — our simple guides to how robots work.