30% off your first 3 months

Get the deal

Definition

Inverse kinematics

Inverse kinematics finds the joint angles that put a robot's hand, foot or tool at a chosen position, the reverse of forward kinematics.

  • Forward kinematics: joint angles in, hand position out. Inverse kinematics: hand position in, joint angles out.
  • A target can have two solutions, one solution, or none if it is out of reach.

A robot arm is a chain of rigid links joined by motors. If you know every joint angle, working out where the end of the arm is takes only trigonometry. That direction is called forward kinematics, and it always has exactly one answer.

Robots usually need the opposite. A task says where the gripper should go, and the controller has to find joint angles that put it there. That is inverse kinematics, often shortened to IK. It is harder, because a target can have several answers or none.

Take a flat arm with two links, each 1 meter long, mounted at the origin. The first joint angle θ1 is measured from the x-axis, and the second, θ2, is the bend at the elbow. Where should the joints go so the tip reaches (1, 1)?

  1. Elbow angle from the law of cosines: cos θ2 = (x² + y² − L1² − L2²) / (2·L1·L2) = (1 + 1 − 1 − 1) / 2 = 0, so θ2 = 90°.
  2. Shoulder angle: θ1 = atan2(y, x) − atan2(L2·sin θ2, L1 + L2·cos θ2) = 45° − atan2(1, 1) = 45° − 45° = 0°.
  3. Check with forward kinematics: the elbow sits at (1, 0), and the second link points at θ1 + θ2 = 90°, straight up, so the tip lands at (1, 0) + (0, 1) = (1, 1).

Choosing θ2 = −90° instead gives θ1 = 90°, the elbow at (0, 1) and the tip again at (1, 1). These are the elbow-up and elbow-down solutions. A real controller picks one based on obstacles, joint limits or which is closer to the current pose.

When there is no answer

This arm can only reach points between 0 and 2 meters from its base, the difference and the sum of the link lengths. Ask for a point 2.5 meters away and the cosine formula returns a value above 1, which no angle has. Good IK code checks for that instead of sending a motor to an impossible angle.

Arms with six or seven joints rarely have a neat formula like this. Their controllers solve IK numerically, nudging all the joints in small steps until the tip is close enough to the target. The same idea moves the legs of walking robots, where each foot is a target.

Further reading

Reviewed . Next review .

Owner: DuckyHelper

Questions and jobs

Do anything

Ask it a question or hand it a job, in any app.

Doing jobs for you is in early access on Mac. Asking works on Mac, Windows and Linux.