Forward kinematics: “I set the joints like this, where is the hand?” Inverse kinematics is the other way round: “I want the hand here, how do I set the joints?” It is harder because the answer can be two poses, one pose, infinitely many, or none at all.
The course splits it in two:
- Analytical IK (4.1): exact formulas from geometry and algebra. Small planar arms.
- Numerical IK (4.2): a guess-and-correct loop with the Jacobian. Everything else.
Most of 4.1 turns out to be much easier than it looks. Most of the questions are “draw the arm and think” questions, not algebra marathons.
Warm-up: the one-link arm
One joint at the origin, one link of length . FK is , . Square both, add, use :
So the workspace is a circle, not a disc. A target inside the circle is as unreachable as one outside: the rigid link would overshoot it.
Recipe: compute . Not ? No configuration exists. Equal? Then .
With : gives , reachable at . gives , unreachable. One joint means one number, so write , not a vector.
Linear FK: IK is just Gauss
Sometimes FK is handed to you as a matrix: . Then IK is solving . No trig at all.
- Write the augmented matrix . The target goes right of the bar. (At 2 am I put the s there. Don’t.)
- Clear everything below the diagonal with row operations.
- Back-substitute from the bottom row up.
- Plug back into and check you get .
For a the inverse formula is faster: . The calculator solves these too, but write the steps if the question asks for them.
arctan2 and the Casio trick
Using arctan2 is important for the exam, so it is worth understanding why plain arctan is not enough.
Plain only sees the ratio. and are the same number, so it cannot tell the bottom-right quadrant from the top-left. The classic example:
takes both numbers separately, checks their signs, and returns the real angle of the point , anywhere in the circle.
The Casio fx-991ES PLUS has no arctan2 button, but it has Pol, polar conversion, which does exactly the same thing:
- SHIFT + [+] opens
Pol(. - Type the x value. SHIFT + [)] gives the comma. Type the y value. Close the bracket.
- Press =. It shows and . is your arctan2.
Order flip. The maths writes , y first. Pol wants , x first. And as a bonus, is the distance to the target, which is exactly what the reachability check needs.
The 2-link planar arm
Two links , , shoulder angle , elbow angle . Elbow first, from the cosine rule:
If comes out bigger than 1 or smaller than , the target is out of reach and you are done. The is the elbow-up / elbow-down choice.
Then the shoulder, as a difference of two angles:
- is the angle of the straight line from the base to the target.
- is how far link 1 sits off that line because the elbow is bent. Draw the triangle and it is obvious.
Worked example: , target , and given.
- : .
- : and , so .
- .
The target is below the -axis and the elbow bends up, so the shoulder has to rotate down to compensate. The negative answer makes sense, and that kind of quick “does the sign make sense?” check is worth doing every time.
How many solutions? Picture the arm
This one throws people because there is nothing to calculate. Take , so the maximum reach is 2 and folding the arm back gets you to 0.
| Distance to target | Solutions | Why |
|---|---|---|
| none | even fully stretched the arm is too short | |
| exactly one | only the straight arm () gets there | |
| two | elbow up or elbow down, both hit it | |
| infinitely many | elbow folded back (), shoulder spins freely |
The last row is my favourite: with the arm folded flat on itself the tip sits on the base, and you can spin like a ceiling fan without the tip moving at all.
Numerical IK: walking to a door in the dark
It looks like wizardry, but it is how you would walk to a door in a dark room:
- Guess. Pick some joint angles , even random ones.
- Check. Run FK to see where the hand actually is. Compare with the target: the error is . Zero error? Done.
- Correct. The Jacobian says “if I tweak the joints a little, the hand moves like this.” Its inverse turns that around: “the hand is off by this much, so tweak the joints by this much.”
- Repeat. Update and go again, many times a second, until the error is basically zero.
It is an approximation (Taylor expansion of FK, truncated after the linear term), which is why it has to loop.
It breaks near singularities: when , blows up and the correction step goes crazy. And when the robot is redundant (more joints than workspace coordinates, like 3 joints on a 2-D target), is not square and has no inverse. Then you use the pseudo-inverse , which picks the “cheapest” of the infinitely many solutions.