Manipulator Basics · Theory · Module 07 of 14
07 — Inverse Kinematics
Inverse kinematics finds the joint values that put the tool at a desired pose. Solve the 2R arm exactly by geometry and algebra, meet the elbow-up and elbow-down branches, and then iterate with the Jacobian, learning why damped least squares is the method of choice near singularities.
Most tasks are specified where the tool must be, not what the joints must do. IK bridges the two, and unlike FK it can fail, return several answers or need a good starting guess.
Learning objectives
After this module you should be able to:
- Derive the closed-form IK of a planar 2R arm geometrically and algebraically, including both branches.
- Decide whether a target is reachable and what joint limits do to the solution set.
- Solve 3R planar IK by wrist-point decoupling.
- Explain and compare Jacobian-pseudoinverse, Jacobian-transpose and damped least-squares IK.
- Recognise non-convergence, local minima and singularities, and choose among multiple solutions.
Conceptual explanation
Given a desired tool pose , IK seeks with . The answer depends on the target and the robot:
- No solution: the target is outside the workspace, or reachable only with joints beyond their limits.
- Finitely many: a 2R arm usually has two (elbow up and elbow down); a general 6-DOF arm can have up to 16, and a typical industrial arm with a spherical wrist up to 8.
- Infinitely many: on certain singular targets, or for a redundant arm with more joints than task constraints.
Analytic versus numerical
Analytic (closed-form) IK gives every solution exactly and fast, by geometry or algebra. It exists only for special designs, such as planar arms or 6-DOF arms with a spherical wrist (Pieper's condition). Numerical IK starts from a guess and walks downhill on the pose error using the Jacobian. It works for any arm, but finds one solution near the guess, may stop at a local minimum, and needs care near singularities.
Decoupling
Many arms split into a positioning part and an orienting part. For a planar 3R arm with a required heading , the wrist point is fixed by the target, so the first two joints solve a 2R problem and the last joint makes up the heading. For a 6-DOF arm with a spherical wrist, joints 1–3 place the wrist centre and joints 4–6 set the orientation.
Choosing among solutions
Controllers pick the solution closest to the current configuration (to avoid big joint swings), the one inside joint limits with the most margin, or one on a requested branch (for example "elbow up, wrist not flipped") so that a program behaves the same every time. Practise in Lab 05.
Mathematical formulation
Planar 2R, algebraic: squaring and adding the FK equations eliminates :
Reachable only if |c₂| ≤ 1, i.e. |L₁ − L₂| ≤ r ≤ L₁ + L₂.
The sign picks the branch. Use atan2 rather than arccos, so the angle lands in the right quadrant.
Geometrically: the direction to the target minus the angle the forearm adds at the shoulder.
Numerical IK: with task error , each iteration updates with one of
DLS minimises . In terms of the singular values of , the pseudoinverse scales each direction by , which blows up as . DLS scales it by , which stays bounded by :
Diagrams
Worked examples
Example 1: analytic 2R IK
Links , m; target m, at distance m, inside the ring .
| Branch | q₁ | q₂ |
|---|---|---|
| elbow up | 59.45° | -67.98° |
| elbow down | 2.48° | 67.98° |
Example 2: numerical IK from a nearly straight arm
The same target, starting from , close to the stretched singular pose:
| Method | Converged | Iterations | Final position error | Solution |
|---|---|---|---|---|
| pseudoinverse | yes | 8 | 0.000 mm | (2.48°, 67.98°) |
| damped least squares (λ = 0.05) | yes | 7 | 0.008 mm | (2.48°, 67.98°) |
| transpose (optimal step) | yes | 28 | 0.062 mm | (2.49°, 67.96°) |
Each method returned the elbow-down branch, the one nearest the start. Numerical IK does not choose a branch for you; the initial guess does.
Example 3: one step near a singularity
At the arm is almost straight and one singular value of is tiny. For a 14 mm error m, the pseudoinverse step is rad (106°): a wild jump. The DLS step with is rad. Real solvers also cap the step size, as the engine does.
Example 4: an unreachable target
The target m is 0.825 m away, beyond the 0.70 m reach. DLS stops with mm and reports: "stalled: the error stopped decreasing (target unreachable or a singular configuration)". The arm ends almost straight and pointing at the target, which is the closest it can get. A good IK routine reports failure honestly instead of returning that pose as a solution.
Example 5: planar 3R with a heading, and a 6-DOF arm
For the 3R arm (0.40, 0.30, 0.15 m) the target with heading 0° puts the wrist at . The two solutions are and .
For the 6-DOF arm, numerical IK from 40 random starts found 6 distinct solutions for the pose of Module 06, Example 4:
| # | q₁ | q₂ | q₃ | q₄ | q₅ | q₆ |
|---|---|---|---|---|---|---|
| 1 | 30° | 60° | -60° | 0° | -45° | 0° |
| 2 | -150° | 120° | 60° | 180° | -45° | 0° |
| 3 | 30° | 0° | 60° | 0° | -105° | 0° |
| 4 | 30° | 60° | -60° | -180° | 45° | -180° |
| 5 | -150° | 120° | 60° | 0° | 45° | 180° |
| 6 | 30° | 0° | 60° | -180° | 105° | 180° |
Interactive experiment
Interactive 2R inverse kinematics (needs JavaScript).
Real-world applications
- Cartesian moves (linear moves of the tool) solve IK at every interpolation point.
- Teleoperation and jogging use the velocity form () to follow hand-controller motion smoothly.
- Pick and place converts a grasp pose computed from vision into joint targets (see the capstone).
- MoveIt 2 uses kinematics plugins: numerical (KDL, TRAC-IK) or analytic (IKFast) solvers behind one interface.
Common mistakes
Using arccos instead of atan2
arccos only returns 0…180° and loses the branch sign; atan2 of sine and cosine gives the correct quadrant.
Accepting the last iterate as a solution
Always check the final error against a tolerance. An iteration limit or a stall is a failure.
Ignoring joint limits after solving
An exact analytic solution may violate limits. Check each candidate and discard or wrap angles as the joint allows.
Plain pseudoinverse near singularities
Near σ → 0, J⁺ produces huge joint steps. Use DLS (or SVD with a cut-off) and limit the step size.
Jumping between branches during a path
Solving each point independently can switch elbow up and elbow down mid-move. Seed each solve with the previous solution.
Key takeaways
- IK can have none, one, several or infinitely many solutions.
- Closed-form 2R IK: cos q₂ from the distance, the branch from the sign of sin q₂, then q₁ from the geometry.
- Numerical IK iterates with J⁺, Jᵀ or DLS from an initial guess and finds the nearby solution.
- DLS bounds the step near singularities at the price of a small bias; always check convergence honestly.
Knowledge check
Write an answer to each question, then reveal the explanation. Your answers stay in your browser.
Question 1
For a 2R arm with L₁ = 0.4 m and L₂ = 0.3 m, which distances from the base are reachable?
Explanation
From |L₁ − L₂| = 0.1 m to L₁ + L₂ = 0.7 m, for joints without limits.
Question 2
What happens to the two 2R solutions when the target is exactly on the outer boundary?
Explanation
They merge: sin q₂ = 0, so q₂ = 0 and the arm is fully stretched, a singular configuration.
Question 3
Numerical IK from two different starting guesses returns two different answers. Is something wrong?
Explanation
Not necessarily: each converges to a solution near its start. Check both errors; if both are below tolerance, they are two valid branches.
Question 4
Why does the damped least-squares step stay finite when J is singular?
Explanation
Each singular direction is scaled by σ/(σ² + λ²) ≤ 1/(2λ) instead of 1/σ, so the step is bounded.
Question 5
How does wrist-point decoupling simplify 3R planar IK?
Explanation
The required heading fixes the wrist point (target minus L₃ along the heading); joints 1–2 solve a 2R problem for it, and q₃ = φ − q₁ − q₂.
Practise it in the labs
Then test yourself in practice exercises and challenge mode.
References and further reading
- S. R. Buss, "Introduction to inverse kinematics with Jacobian transpose, pseudoinverse and damped least squares methods", University of California San Diego, 2009.
- C. W. Wampler, "Manipulator inverse kinematic solutions based on vector formulations and damped least-squares methods", IEEE Transactions on Systems, Man and Cybernetics, 16(1), 1986.
- D. L. Pieper, "The kinematics of manipulators under computer control", Ph.D. thesis, Stanford University, 1968.