Inverse kinematics

On this page 8

Inverse kinematics (IK) is the computation of the joint values a robot must adopt so that its end effector, such as a gripper or tool flange, reaches a specified position and orientation in space. In robotics and especially in manipulation, it is the step that turns a goal expressed in Cartesian coordinates, for example a grasp pose from a camera, into commands that the joint motors can execute.

IK is the reverse of forward kinematics, which maps known joint angles to a single end-effector pose. The reverse direction is much harder: depending on the arm and the target, the problem can have several solutions, infinitely many solutions or none at all, and the equations are nonlinear in the joint variables.

How inverse kinematics solves for joint values

Inverse kinematics inverts the kinematic chain model of the manipulator. The model, often written with Denavit-Hartenberg parameters or as a chain of homogeneous transforms in a URDF description, defines how each joint rotates or translates the next link. Forward kinematics multiplies these transforms to obtain the pose of the end effector; IK searches for the joint vector that makes that product equal to the target pose.

A full pose in three-dimensional space has six degrees of freedom: three for position and three for orientation. An arm with six joints can therefore, in principle, reach a pose with a finite number of configurations, while an arm with seven or more joints is redundant and has a continuous family of solutions for the same pose. An arm with fewer than six joints, such as a four-axis SCARA robot, can only satisfy a subset of the pose, typically position plus rotation about the vertical axis.

The table contrasts the two directions of the kinematic problem.

PropertyForward kinematicsInverse kinematics
InputJoint angles or displacementsDesired end-effector pose
OutputEnd-effector poseJoint angles or displacements
Number of solutionsExactly oneZero, finite set or infinite set
ComputationDirect matrix multiplicationClosed-form derivation or iterative search
Typical failureNone for valid joint valuesUnreachable target, singularity, joint limits
Forward and inverse kinematics compared

Analytical and numerical IK methods

IK solvers fall into two families. Analytical (closed-form) solvers derive explicit equations for each joint, while numerical solvers start from an initial guess and iterate until the forward kinematics of the guess matches the target within a tolerance. Closed-form solutions exist for many industrial six-axis arms because they satisfy Pieper’s condition: three consecutive joint axes intersect at one point, the spherical wrist, which decouples wrist position from wrist orientation.

For a planar two-link arm with link lengths L1 and L2, the elbow angle follows from the law of cosines, cos(q2) = (x² + y² − L1² − L2²) / (2·L1·L2), and the shoulder angle from q1 = atan2(y, x) − atan2(L2·sin(q2), L1 + L2·cos(q2)). The sign of q2 selects the elbow-up or elbow-down branch. Numerical methods replace such derivations with the Jacobian matrix, which relates small joint changes to small end-effector changes.

The following table summarizes the main solution methods and where each fits.

MethodPrincipleStrengthsWeaknesses
Closed-form geometric or algebraicExplicit equations per jointMicrosecond speed, returns all solutionsOnly for specific geometries
Jacobian pseudoinverseIterates with the Moore-Penrose inverseGeneral, handles redundancyUnstable near singularities
Jacobian transposeGradient step along the transposed JacobianCheap per iterationSlow convergence
Damped least squaresAdds a damping term to the pseudoinverseRobust near singularitiesSmall tracking error from damping
Optimization-basedMinimizes pose error under constraintsJoint limits and extra goals built inSlower, may stop in local minima
Common inverse kinematics solution methods

In practice, libraries such as IKFast generate closed-form code for a given arm, while KDL and TRAC-IK provide numerical solvers. TRAC-IK runs a Newton-type solver and a sequential quadratic programming solver in parallel and returns whichever succeeds first, which markedly improves the success rate compared with a single Newton iteration near joint limits.

Multiple solutions, redundancy and reachability

A typical six-axis industrial arm with a spherical wrist has up to eight IK solutions for a single reachable pose, and a general six-revolute arm can have up to sixteen. The eight solutions come from three binary choices, and controllers expose them as configuration flags so that a program can request a specific posture.

ChoiceAlternativesPractical consequence
ShoulderFront or back (lefty or righty)Determines which side of the base the arm works from
ElbowUp or downChanges clearance to tables and fixtures
WristFlip or no flipRotates joints 4 and 6 by about 180 degrees each
Configuration choices of a six-axis arm with a spherical wrist

Redundant arms with seven joints add a null space: joint motions that leave the end-effector pose unchanged, often called self-motion. Solvers use this freedom for secondary objectives such as avoiding joint limits, keeping the elbow away from obstacles or maximizing manipulability. Choosing among solutions is a design decision, and the usual default is the solution closest to the current joint state to avoid large unexpected motions.

Reachability is bounded by the workspace. The reachable workspace contains every point the tool can touch in some orientation; the smaller dexterous workspace contains points reachable in every orientation. A target outside the reachable workspace has no IK solution, and a good solver reports this explicitly rather than returning the nearest pose silently.

Singularities and joint limits

A kinematic singularity is a configuration in which the Jacobian loses rank, so the end effector cannot move in at least one direction regardless of joint speeds. Near a singularity, the pseudoinverse produces very large joint velocities for small Cartesian motions, which is why industrial controllers often stop a linear move or slow it down sharply when approaching one.

SingularityGeometric conditionSymptom
Wrist singularityJoint 5 near 0 degrees, axes 4 and 6 alignedJoints 4 and 6 spin rapidly in opposite directions
Shoulder singularityWrist center on or near the axis of joint 1Joint 1 must rotate very fast
Elbow singularityArm fully stretched or foldedLoss of reach direction at the workspace boundary
Typical singularities of a six-axis arm

Joint limits and self-collision constraints remove further solutions. A mathematically valid answer that requires 200 degrees on a joint limited to ±170 degrees is useless, so production solvers either clamp, reject or optimize within limits. Damped least squares, with a damping factor that grows near singular configurations, is the standard compromise between accuracy and smooth motion.

Using IK in manipulation pipelines

In manipulation, IK sits between grasp planning, which proposes target poses for the gripper, and motion planning, which searches for a collision-free path in joint space. Each candidate grasp is passed through IK, and grasps without a valid solution are discarded before path planning begins.

SituationRecommended approachReason
Standard six-axis arm, high-rate controlClosed-form solverDeterministic, fast, all branches available
Seven-axis collaborative armNumerical solver with null-space goalsExploits redundancy for posture control
Teleoperation or visual servoingDamped least squares on velocitiesSmooth near singularities
Many constraints, offline planningOptimization-based IKCombines pose, limits and preferences
Choosing an IK approach

Common mistakes with inverse kinematics

  • Ignoring the frame definitions: a target expressed in the camera frame but solved in the base frame produces a confident yet wrong answer.
  • Mixing tool center point offsets: forgetting the gripper length shifts every solution by tens of millimeters.
  • Accepting any returned solution: switching branches between consecutive waypoints causes sudden wrist flips.
  • Treating convergence failure as unreachability: numerical solvers can fail from a poor seed, so retrying with random seeds is standard practice.
  • Assuming IK guarantees a safe path: IK only validates the final pose, not the motion that leads to it.

In plain words

When you reach for a cup, you think about where your hand should go, not about the exact angles of your shoulder, elbow and wrist. Your brain works out those angles for you. Inverse kinematics does the same job for a robot arm: it starts from where the hand must be and calculates how every joint should bend.

The tricky part is that there is often more than one way to reach the same spot, just as you can touch your nose with the elbow raised or lowered. Sometimes the spot is simply too far away. A good IK solver picks the most sensible posture and clearly says when a target cannot be reached.

A real-world example

A logistics company installs a six-axis arm to pick parcels from a conveyor. A 3D camera detects each parcel and outputs a grasp pose in the camera frame. The software transforms the pose into the robot base frame, adds the 150 mm suction-gripper offset, and calls a closed-form IK solver, which returns up to eight joint configurations.

The cell software discards solutions that violate joint limits or would place the elbow over the conveyor guard, then selects the one closest to the current joint state. Parcels near the far edge of the belt sometimes fall outside the reachable workspace; the solver reports no solution and the system lets them pass to a second station instead of attempting an unsafe stretch. After this logic was added, unexpected wrist flips disappeared and the arm sustained a steady pick rate without singularity stops.