Inverse Kinematics: Solving the Robot Arm Problem

simulator advanced ~12 min
Loading simulation...
IK solution: θ₁ ≈ 18°, θ₂ ≈ 47° (elbow-up)

For a 2-link arm (L₁=1.5m, L₂=1.2m) reaching target (1.5, 1.0), the elbow-up solution is approximately θ₁=18°, θ₂=47°. An elbow-down solution also exists.

Formula

cos(θ₂) = (x² + y² - L₁² - L₂²) / (2 L₁ L₂)
θ₁ = atan2(y, x) - atan2(L₂ sin(θ₂), L₁ + L₂ cos(θ₂))
Workspace: |L₁ - L₂| ≤ √(x² + y²) ≤ L₁ + L₂

The Fundamental Problem of Robotics

Every time a robot arm reaches for an object, it must solve inverse kinematics: given a desired hand position, compute the joint angles that achieve it. Forward kinematics is easy — plug angles into trigonometry and get the hand position. Inverse kinematics reverses this process, and it's far more challenging because multiple solutions (or no solution) may exist.

The 2-Link Planar Arm

The 2-link planar arm is the simplest non-trivial IK problem. Two rigid links of lengths L₁ and L₂, connected by revolute joints, must reach a target (x, y). The law of cosines gives θ₂ (elbow angle), then θ₁ (shoulder angle) follows from geometry. The ± sign on θ₂ yields two valid solutions: elbow-up and elbow-down. This elegant closed-form solution exists because the 2-link problem has exactly 2 DOF matching the 2D target.

Workspace and Singularities

The reachable workspace of a 2-link arm is an annular ring: the target must be at least |L₁-L₂| and at most L₁+L₂ from the base. At the outer boundary (arm fully extended), the arm hits a kinematic singularity — it can only move tangentially, not radially. Near singularities, tiny target movements demand huge joint velocities, making control difficult. Industrial robots are programmed to avoid singularity regions.

Scaling to Real Robots

Industrial robots typically have 6 degrees of freedom (3 for position, 3 for orientation). Closed-form IK solutions exist for most 6-DOF industrial arm geometries. For arbitrary kinematic chains, numerical methods like the Jacobian transpose, damped least squares, or iterative algorithms (CCD, FABRIK) are used. Redundant robots with 7+ DOF have infinitely many IK solutions, offering flexibility to avoid obstacles or singularities.

FAQ

What is inverse kinematics?

Inverse kinematics (IK) computes the joint angles needed to place a robot's end-effector at a desired position and orientation. It's the reverse of forward kinematics (FK), which computes end-effector position from known joint angles. IK is essential for robot control — you want to move the hand to a target, not set individual joint angles.

Why does a 2-link arm have two IK solutions?

A 2-link planar arm can reach most points in its workspace with two configurations: elbow-up and elbow-down. Both place the end-effector at the same target, but the elbow bends in opposite directions. This is a fundamental property — more complex robots may have infinitely many solutions.

What is a kinematic singularity?

A singularity occurs when the arm is fully extended or fully folded — the Jacobian matrix loses rank and small Cartesian movements require infinite joint velocities. At the workspace boundary, the arm loses a degree of freedom and cannot move in the radial direction.

How is IK used in animation and games?

IK is widely used to make character limbs reach targets naturally — feet plant on uneven terrain, hands grasp objects, heads track targets. Game engines use iterative IK solvers (like CCD or FABRIK) that handle arbitrary chain lengths.

Sources

Embed

<iframe src="https://homo-deus.com/lab/robotics/inverse-kinematics/embed" width="100%" height="400" frameborder="0"></iframe>
View source on GitHub