Forward is easy, inverse is the hard direction
A robot arm is a chain of rigid links joined by rotating joints. Given every joint angle, computing where the end effector (the gripper) ends up is a straightforward chain of rotations and translations — forward kinematics — one matrix multiplication per joint, always exactly solvable, always exactly one answer. Inverse kinematics asks the opposite question: given where you want the gripper, what joint angles get it there? That is the hard direction. For anything past a two-link planar arm there is generally no closed-form formula, there can be multiple valid solutions (elbow-up versus elbow-down), and some target poses have none at all because they lie outside the arm's reach.
Forward kinematics: the chain of transforms
Each joint contributes a rotation by its current angle followed by a translation along the link length to the next joint. Chaining these transforms from the base out to the gripper gives its position as a function of every joint angle — the classic formalism for this is Denavit-Hartenberg parameters, four numbers per joint (link length, link twist, link offset, joint angle) that fix an unambiguous, composable convention for the transform chain:
T_effector = T_1(theta_1) . T_2(theta_2) . ... . T_n(theta_n) // each T_i is a 4x4 homogeneous rotation+translation matrix // built from that joint's Denavit-Hartenberg parameters
Cyclic Coordinate Descent
Instead of solving that chain analytically, Cyclic Coordinate Descent (CCD) solves it one joint at a time, iteratively, which is why it is the go-to method for arms with more than a couple of links or with joint limits that break closed-form solutions. Starting from the joint closest to the gripper and working back toward the base, each pass:
for joint j = last .. first: v1 = (end_effector_pos - joint[j].pos), normalized v2 = (target_pos - joint[j].pos), normalized angle = angle_between(v1, v2) rotate joint j by `angle` around its axis, toward v2 clamp joint j to its mechanical limits recompute forward kinematics for every joint after j repeat the whole sweep until the effector is within tolerance of target, or a max iteration count is hit
Each single-joint rotation is a closed-form, one-line calculation — rotate this one joint by exactly the angle that best points the current end effector at the target, given everything else fixed — so a full sweep across n joints costs only O(n) work, and a handful of sweeps (rarely more than 10-15) typically converges to sub-millimetre accuracy. That is dramatically cheaper than the alternative, Jacobian-based IK, which builds and pseudo-inverts an n-by-3 (or n-by-6, with orientation) matrix of partial derivatives every single iteration — more numerically robust near certain configurations, but far more expensive per step.
Joint limits, redundancy and unreachable targets
Real joints do not rotate freely — a shoulder or elbow has hard mechanical stops — so every CCD iteration clamps the proposed angle to the joint's allowed range before moving on. This is also where CCD's elegance shows: because it treats each joint independently within a sweep, clamping one joint's limit costs nothing extra, whereas a Jacobian solver has to fold limits into the linear system as constraints, which is considerably more involved.
An arm with more joints than the 3 (position only) or 6 (position + orientation) degrees of freedom needed to specify the target is kinematically redundant — infinitely many joint configurations reach the same gripper pose, which is exactly why a human elbow can swing through an arc while the hand stays perfectly still on a table. CCD does not choose among these solutions with any preference (unlike a Jacobian method with a null-space secondary objective, which can, say, prefer configurations that avoid obstacles); it simply converges to whichever local solution its greedy joint-by-joint sweeps happen to find first, seeded by the arm's current pose.
When a target sits outside the arm's total reach (further than the sum of all link lengths) no configuration exists, and CCD will converge instead to the closest reachable point along the line toward the target — the arm fully extends and points as close to the target direction as physically possible, which is the correct and expected behaviour for an unreachable request.
From IK to a pick-and-place sequence
An automated pick-and-place task chains several IK solves together: move above the object, descend to grasp height, close the gripper, retract, move above the destination, descend, release, retract. Each waypoint is an independent IK call; obstacle avoidance is layered on top by inserting intermediate waypoints that route around known obstacles rather than by modifying the IK solver itself, which is precisely why this decomposition — waypoints plus a fast per-waypoint IK solve — is the standard structure of real pick-and-place controllers on the factory floor, not just of this simulation.
Frequently asked questions
Why not just solve inverse kinematics with one formula, like forward kinematics?
A closed-form algebraic solution exists only for simple, low-joint-count arm geometries. Past a few joints — or with joint limits and redundant degrees of freedom — there is generally no single formula; the equations become nonlinear and can have zero, one, or infinitely many solutions, which is why iterative numerical methods like CCD or Jacobian-based solvers are used instead.
What happens if I drag the target somewhere the arm can't physically reach?
CCD converges to the closest reachable point in that direction — the arm fully extends toward the target without ever exactly reaching it. This is the correct behaviour for an unreachable request; there is no configuration of the joints that would close the remaining gap, since it exceeds the sum of the arm's link lengths.
Why does CCD start from the joint nearest the gripper instead of the base?
Rotating the joint closest to the end effector has the most direct, largest effect on the gripper's position for the least angular change, so starting there converges fastest. Working back toward the base lets each subsequent joint make a smaller corrective adjustment, and a handful of full sweeps is usually enough to converge to sub-millimetre accuracy.
Try it live
Everything above runs in your browser — open Robot Arm Pick & Place and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.
▶ Open Robot Arm Pick & Place simulation