Robot Kinematics
Kinematics maps joint angles to where the robot's tool is — and back. Learn joints and degrees of freedom, coordinate frames and homogeneous transforms, Denavit–Hartenberg parameters, forward and inverse kinematics, workspace, Jacobians and singularities.
To pick up a part, a robot controller must answer: 'what joint angles put my gripper here, at this orientation?' That's inverse kinematics. The reverse — 'where is the gripper for these joint angles?' — is forward kinematics.
Both rely on coordinate frames attached to each link and chained together with matrices.
An analogy
Your arm is a robot: shoulder, elbow and wrist angles decide where your hand is. You solve inverse kinematics unconsciously every time you reach for a cup.
Joints, links and DOF
Revolute joints rotate; prismatic joints slide. A free rigid body has 6 DOF (3 position + 3 orientation), so general-purpose arms have 6 joints. SCARA robots (4 DOF) suit planar pick-and-place; Cartesian gantries use 3 prismatic axes; 7-DOF arms add redundancy to avoid obstacles.
Frames and homogeneous transforms
Each link carries a coordinate frame. A 4 × 4 matrix combines a 3 × 3 rotation and a position vector; multiplying them chains frames from base to tool. Denavit–Hartenberg (DH) parameters (θ, d, a, α) describe each joint with four numbers.
Inverse kinematics and workspace
IK may have several solutions, one, or none (target out of reach). The workspace is the set of reachable points: for a 2-link arm, an annulus between |L₁ − L₂| and L₁ + L₂. Industrial 6-axis arms with spherical wrists have closed-form IK; others use numerical methods.
Jacobians and singularities
The Jacobian maps joint velocities to tool velocities (and, transposed, tool forces to joint torques). At singularities (arm fully stretched, wrist axes aligned) the Jacobian loses rank: some tool motions become impossible and joint speeds blow up. Path planners avoid them; damped least-squares IK stays stable nearby.
Formulas
- 2-link planar FK:
x = L₁cos θ₁ + L₂cos(θ₁ + θ₂), y = L₁sin θ₁ + L₂sin(θ₁ + θ₂) - 2-link planar IK:
cos θ₂ = (x² + y² − L₁² − L₂²)/(2L₁L₂), θ₁ = atan2(y, x) − atan2(L₂ sin θ₂, L₁ + L₂ cos θ₂) - Chained transforms:
⁰T_n = ⁰T₁ · ¹T₂ · … · ⁿ⁻¹T_n - Velocity kinematics:
ẋ = J(θ) · θ̇, singular when det J = 0
Worked example: Forward kinematics
Given: L₁ = 0.4 m, L₂ = 0.3 m; θ₁ = 30°, θ₂ = 45°
Find: Tool position.
- x = 0.4 cos 30° + 0.3 cos 75° = 0.346 + 0.078 = 0.424 m
- y = 0.4 sin 30° + 0.3 sin 75° = 0.200 + 0.290 = 0.490 m
Answer: (0.424, 0.490) m
Worked example: Inverse kinematics
Given: Target (0.5, 0.3) m
Find: Joint angles (elbow down).
- cos θ₂ = (0.25 + 0.09 − 0.16 − 0.09)/0.24 = 0.375 → θ₂ = 67.98°
- θ₁ = atan2(0.3, 0.5) − atan2(0.278, 0.512) = 30.96° − 28.48° = 2.48°
Answer: θ₁ ≈ 2.5°, θ₂ ≈ 68.0°
Forward & inverse kinematics of a 2-link arm (Python)
import math
def fk(t1, t2, L1=0.4, L2=0.3):
x = L1*math.cos(t1) + L2*math.cos(t1 + t2)
y = L1*math.sin(t1) + L2*math.sin(t1 + t2)
return x, y
def ik(x, y, L1=0.4, L2=0.3, elbow_up=False):
c2 = (x*x + y*y - L1*L1 - L2*L2) / (2*L1*L2)
if abs(c2) > 1:
raise ValueError("target out of reach")
t2 = math.acos(c2) * (-1 if elbow_up else 1)
t1 = math.atan2(y, x) - math.atan2(L2*math.sin(t2), L1 + L2*math.cos(t2))
return t1, t2
print(fk(math.radians(30), math.radians(45))) # (0.424, 0.490)
print([math.degrees(a) for a in ik(0.5, 0.3)]) # [2.48, 67.98]Two IK solutions exist (elbow up/down); real robots choose based on joint limits and obstacles.
Common mistakes
- Wrong: Mixing degrees and radians in trig functions. — Right: Programming libraries use radians; convert inputs.
- Wrong: Ignoring multiple IK solutions. — Right: Select the branch (elbow up/down, wrist flip) consistently to avoid sudden jumps.
Applications
- Industrial arms: Welding, painting and assembly paths computed through IK in real time.
- Surgical robots: Remote-centre-of-motion kinematics keep instruments pivoting at the incision.
- Legged robots & animation: Foot placement and character rigs use the same IK methods.
Key takeaways
- FK: joints → pose; IK: pose → joints (multiple solutions).
- Homogeneous transforms chain link frames.
- Workspace limited by link lengths and joint limits.
- Avoid singularities (det J = 0).
Going further
- Screw theory & product of exponentials: An alternative to DH that avoids frame-placement ambiguity; standard in modern robotics texts.
- Redundancy resolution: 7-DOF arms use the null space of J to avoid obstacles or joint limits while keeping the tool fixed.
- Calibration: Identifying real DH parameters with laser trackers improves absolute accuracy from mm to sub-mm.