🔍🔩 Parts bench
19 lessons

Inverse Kinematics: Aiming the Arm Backwards

From 'the cup is there' to 'set the joints thus' — a problem with two right answers, regions with none, and places where the arm briefly loses a direction of motion.

lesson 2 of 3 in this unit

Builds on: 4.1 Forward Kinematics: Where Did the Hand Go?

The useful direction is the hard one

Nobody commands a robot arm by angles. Tasks arrive as positions — grasp the cup at (x, y) — and someone must recover the angles that put the hand there: inverse kinematics, IK. For the two-link arm the law of cosines cracks it in closed form:

cos θ₂ = (x² + y² − L₁² − L₂²) / (2·L₁·L₂)solve for the elbow first — the target’s distance alone fixes how bent the arm must be

Read the right side: it only asks how far the target is. Distance dictates elbow bend; the shoulder then swings the bent arm onto the bearing. And notice the crack in the equation: a cosine must live in [−1, 1]. Targets too far (or inside the folded hole) push it outside — the formula itself reports unreachable, the workspace lesson speaking algebra.

Two answers, and sometimes none

cos θ₂ = 0.5 has two answers: θ₂ = +60° and −60°. Geometrically: elbow-up and elbow-down — two mirror poses whose hands land on the identical spot. Neither is wrong; real controllers pick by convention, by obstacle clearance, or by whichever is nearest the current pose (to avoid a wild swing through the workspace mid-task). IK answers are a menu, not a verdict.

Singularities: losing a direction

Stretch the arm fully straight and ask for the hand to move further outward: no joint velocity, however large, produces motion in that direction. The arm has hit a singularity — a pose where it locally loses one direction of movement. Near one, tiny hand motions demand huge joint swings; solvers command frantic speeds, and real arms shudder. Industrial path planners route around singular poses the way sailors route around shoals — the map of them is part of knowing an arm.

Six joints, same story

Real arms with six joints trade the law of cosines for numerical solvers — but inherit everything else intact: multiple solutions (typically eight), unreachable regions, singular poses. The two-link arm is not a toy; it is the smallest honest specimen of the species.

⚗️ Lab — The Target Range

Drag a target around; the arm solves IK live. Toggle elbow-up/down, and watch the singularity meter as you graze the workspace edges.

  • Park the target mid-workspace and flip elbow-up/elbow-down: two honest poses, one hand position.
  • Drag the target slowly out past the rim — watch the arm straighten, the meter redline, then the solver give up as cos θ₂ leaves [−1, 1].
  • Slide the target along the rim and watch the joints thrash to follow small motions — the shoal the planners avoid.
120 px
80 px
IK verdict
solved — two ways
cos θ₂
0.03
Singularity
comfortably away

Work it by hand — 0 / 1

No multiple choice here: compute the value and type it. Suffixes like 2.5k or 20m are understood; answers within ±3% count.

1. Arm with L₁ = L₂ = 25 cm; target 35.36 cm straight out (x=35.36, y=0). Using cos θ₂ = (d² − L₁² − L₂²)/(2·L₁·L₂), what is θ₂, in degrees? (Take the elbow-up, positive answer.)

Check your understanding

1. Why does two-link IK generally return two solutions?

2. During the IK computation, cos θ₂ comes out as 1.3. This means…

3. At a fully-stretched singularity, the arm momentarily cannot…

4. Why do controllers prefer the IK solution closest to the arm's current pose?