Glossary · Robotics and control
Inverse kinematics
Also called IK
Working out the joint angles that put a hand or foot at a chosen position, the reverse of forward kinematics.
Forward kinematics goes from joint angles to positions. Inverse kinematics (IK) goes from a desired position, such as “put the left foot 35 cm to the side”, back to joint angles.
It’s harder for three reasons:
- There may be no answer: the target is out of reach.
- There may be many answers: you can touch your nose with your elbow high or low.
- The equations are nonlinear, so in general there’s no simple formula.
A two-bone limb
A leg (thigh and shin) or an arm (upper arm and forearm) has a closed-form answer for its middle joint. If the segments have lengths and and the hip-to-ankle distance is , the law of cosines gives the knee angle between the segments:
If , the leg is fully straight and the target is at or past its reach. The remaining angles then aim the limb toward the target.
The general case: iterate
For longer chains, IK is solved by repeated small corrections. The Jacobian says how the end position moves when each joint moves, . Inverting it gives a step toward the target, with a small damping to stay stable near full reach:
Repeat until the error is small.
In this project
The keyframed recovery moves (the sideways hop and the forward and backward steps) are solved with IK: we choose where the feet and pelvis go, and IK finds the leg angles. An early version had an IK bug that crossed the legs, so the previews now check the gap between the limbs and the IK error.