ROBOTICS 101Concept explainer

Forward and Inverse Kinematics of a Two-Link Arm

Forward kinematics answers "given the joint angles, where is the hand?" Inverse kinematics answers the reverse: "given where I want the hand, what joint angles get it there?"

Click anywhere on the canvas to set a target. The arm solves inverse kinematics and moves there.

Forward kinematics

$$\begin{aligned} x &= L_1\cos\theta_1 + L_2\cos(\theta_1 + \theta_2) \\ y &= L_1\sin\theta_1 + L_2\sin(\theta_1 + \theta_2) \end{aligned}$$

Inverse kinematics

$$\begin{aligned} \cos\theta_2 &= \frac{x^2 + y^2 - L_1^2 - L_2^2}{2 L_1 L_2} \\[4pt] \theta_1 &= \operatorname{atan2}(y,\ x) - \operatorname{atan2}\!\left(L_2\sin\theta_2,\ L_1 + L_2\cos\theta_2\right) \end{aligned}$$

The two choices \(\theta_2 = \pm\arccos(\cdot)\) give the elbow-down and elbow-up solutions.

What to notice

The shaded ring is the workspace, every point the hand can reach. Most points inside it have two solutions, elbow up and elbow down, so inverse kinematics is not unique. Click outside the ring and there is no solution at all, so the arm stretches toward the target as far as it can. When the arm is fully straight or fully folded it is at a singularity, where it loses the ability to move the hand in some directions.

Arms with more joints, like the UR12e, follow the same ideas in 3D. Tools such as MoveIt 2 solve the inverse kinematics for you.