Inverse kinematics

Finding joint values for a desired tool pose: existence and multiplicity of solutions, the planar 2R/3R closed form, wrist-centre decoupling and numerical IK.

Drafted with Aria, reviewed by the AiCanCode.org team. Spotted an error? Use Give Feedback at the bottom of the page.

Why it matters

Tasks are specified in the workspace — "put the screw at (0.6, 0.2, 0.1) m pointing down" — but motors are commanded in joint angles. Inverse kinematics (IK) converts the desired tool pose into joint values. Every Cartesian move, every vision-guided pick and every offline program depends on it, and choosing the wrong one of several solutions can swing the arm into a fixture.

Key ideas

Problem. Given ⁰Tₙ (desired tool pose), find q such that FK(q) = ⁰Tₙ. Unlike forward kinematics, the equations are nonlinear and the answer may be:

  • none — target outside the workspace, or the required orientation not achievable;
  • finite and several — e.g. elbow-up/elbow-down for a 2R arm; up to 8 for a typical 6-axis arm with a spherical wrist (shoulder left/right × elbow up/down × wrist flip/no-flip); up to 16 for a general 6R arm;
  • infinite — redundant arms (n > task DOF) or at singular configurations.

Solvability. A closed-form (analytical) solution exists for most industrial arms because they are designed for it: Pieper's condition — if three consecutive joint axes intersect at a point (a spherical wrist) or are parallel, the 6-DOF IK splits into position and orientation sub-problems.

Kinematic decoupling (6-axis arm with spherical wrist).

  1. Find the wrist centre: p_w = p − d₆·a, where a is the approach (z) axis of the tool and d₆ the wrist-to-tool distance.
  2. Solve the first three joints (θ₁, θ₂, θ₃) so the arm puts the wrist centre at p_w — geometry of a 2R arm in a vertical plane rotated by θ₁.
  3. Compute ³R₆ = (⁰R₃)ᵀ·⁰R₆ and extract the wrist angles θ₄, θ₅, θ₆ as Euler angles.

Methods.

  • Geometric — triangles and the cosine rule (planar arms, the first three joints).
  • Algebraic — manipulate the matrix equation, use atan2 throughout.
  • Numerical — iterate Δq = J⁻¹·Δx (Newton-Raphson), Jacobian transpose, or damped least squares Δq = Jᵀ(JJᵀ + λ²I)⁻¹·Δx near singularities. Needs a starting guess and returns only one solution, but works for any arm.

Use atan2(y, x), not tan⁻¹(y/x). atan2 returns the angle in the correct quadrant over (−180°, 180°].

Choosing among solutions. Prefer the solution nearest the current joint values (minimum joint motion), within joint limits and free of collisions. Robot controllers let you fix the "configuration" (e.g. elbow up, wrist no-flip) to keep it consistent along a path.

Formulas

Planar 2R arm reaching (x, y):

D = cos θ₂ = (x² + y² − L₁² − L₂²) / (2·L₁·L₂)

  • Reachable only if −1 ≤ D ≤ 1, i.e. |L₁ − L₂| ≤ √(x² + y²) ≤ L₁ + L₂.

θ₂ = ±cos⁻¹(D) or more robustly θ₂ = atan2(±√(1 − D²), D)

    • and − give the two elbow configurations.

θ₁ = atan2(y, x) − atan2(L₂·sin θ₂, L₁ + L₂·cos θ₂)

Planar 3R with tool angle φ: wrist point x_w = x − L₃·cos φ, y_w = y − L₃·sin φ, solve 2R for (x_w, y_w), then θ₃ = φ − θ₁ − θ₂.

Articulated arm waist angle: θ₁ = atan2(y_w, x_w) (or θ₁ + 180° for the "reach-back" solution).

Wrist centre: p_w = p − d₆·a

Numerical IK step: Δq = J⁻¹(q)·(x_d − FK(q))

Worked examples

Example 1 (standard). Planar 2R, L₁ = L₂ = 1 m, target (1, 1) m. Find both solutions.

  1. D = (1 + 1 − 1 − 1) / (2·1·1) = 0 → θ₂ = ±90°.
  2. Elbow +: θ₁ = atan2(1, 1) − atan2(1·sin 90°, 1 + 1·cos 90°) = 45° − atan2(1, 1) = 45° − 45° = 0°.
  3. Elbow −: θ₁ = 45° − atan2(−1, 1) = 45° + 45° = 90°.
  4. Check (θ₁ = 90°, θ₂ = −90°): x = cos 90° + cos 0° = 1, y = sin 90° + sin 0° = 1 ✓.

Answer: (θ₁, θ₂) = (0°, +90°) or (90°, −90°).

Example 2 (GATE level). Planar 2R, L₁ = 0.5 m, L₂ = 0.3 m, target (0.6, 0.2) m.

  1. Reach check: √(0.36 + 0.04) = 0.632 m, between 0.2 and 0.8 m ✓.
  2. D = (0.40 − 0.25 − 0.09) / (2·0.5·0.3) = 0.06 / 0.30 = 0.20.
  3. θ₂ = ±cos⁻¹(0.20) = ±78.46°.
  4. atan2(0.2, 0.6) = 18.43°. For θ₂ = +78.46°: atan2(0.3·sin 78.46°, 0.5 + 0.3·0.20) = atan2(0.2939, 0.56) = 27.69°.
  5. Elbow +: θ₁ = 18.43° − 27.69° = −9.26°. Elbow −: θ₁ = 18.43° + 27.69° = 46.13°.
  6. FK check for (−9.26°, 78.46°): x = 0.5·cos(−9.26°) + 0.3·cos(69.20°) = 0.4935 + 0.1065 = 0.600 ✓; y = −0.0804 + 0.2804 = 0.200 ✓.

Answer: (θ₁, θ₂) = (−9.26°, 78.46°) or (46.13°, −78.46°).

Example 3 (wrist centre). A tool tip must be at p = (0.8, 0.2, 0.5) m pointing straight down, a = (0, 0, −1), with d₆ = 0.1 m. p_w = p − d₆·a = (0.8, 0.2, 0.5 + 0.1) = (0.8, 0.2, 0.6) m, and the waist angle θ₁ = atan2(0.2, 0.8) = 14.04°.

Common mistakes

  • Using tan⁻¹(y/x): it loses the quadrant — use atan2.
  • Reporting only one solution when the question asks for all, or forgetting the elbow sign when θ₂ is computed with cos⁻¹.
  • Not checking reachability: |D| > 1 means no real solution.
  • In 3R problems, solving the 2R part for the tool point instead of the wrist point.
  • Subtracting the tool offset along the wrong axis when finding the wrist centre.
  • Expecting a numerical method to find all solutions — it finds the one nearest the starting guess.

For GATE ME

Typical questions give a planar 2R arm and a target and ask for θ₂ (via the cosine rule), θ₁, the number of solutions, or whether the point is reachable. Practise the D-formula, the atan2 expression for θ₁, and always verify with forward kinematics.

Quick check

  1. For a planar 2R arm, how many IK solutions exist for a point strictly inside the reachable annulus?
  2. L₁ = L₂ = 1 m: is (2.5, 0) reachable?
  3. What does |D| = 1 mean physically?
  4. Why use atan2 instead of tan⁻¹?
  5. What is Pieper's condition?

Answers: 1. Two (elbow up and elbow down); 2. No — it is beyond L₁ + L₂ = 2 m; 3. The arm is fully stretched or folded — one solution, on the workspace boundary (singular); 4. It gives the correct quadrant; 5. Three consecutive axes intersecting at a point (or parallel) — then a closed-form solution exists.

Try answering each one aloud before you open it.

  1. 1.What is inverse kinematics in the context of robotics?Concept

    Inverse kinematics is the process of determining the joint angles needed to place the end effector of a robotic arm at a desired position and orientation. It is the reverse of forward kinematics, which calculates the position of the end effector based on given joint angles.

  2. 2.Why is inverse kinematics important in robotic systems?Application

    Inverse kinematics is crucial for robotic systems because it allows for precise control of the robot's end effector to perform tasks such as assembly, welding, or painting. It enables the robot to reach a specific target position and orientation, which is essential for automation and interaction with the environment.

  3. 3.What are some common methods used to solve inverse kinematics problems?Concept

    Common methods for solving inverse kinematics problems include analytical solutions, numerical methods, and iterative approaches. Analytical solutions involve deriving explicit equations for joint angles, while numerical methods use algorithms like the Jacobian inverse or pseudo-inverse. Iterative approaches, such as the Cyclic Coordinate Descent (CCD) method, adjust joint angles incrementally to reach the desired position.

  4. 4.What challenges might arise when solving inverse kinematics for a robotic arm?Application

    Challenges in solving inverse kinematics include the existence of multiple solutions, singularities, and joint limits. Multiple solutions can occur when there are different joint configurations that achieve the same end effector position. Singularities are configurations where the robot loses degrees of freedom, making certain movements impossible. Joint limits restrict the range of motion, complicating the solution.

  5. 5.How does the Jacobian matrix assist in solving inverse kinematics problems?Application

    The Jacobian matrix relates the velocities of the robot's joints to the velocity of the end effector. In inverse kinematics, it is used to iteratively adjust joint angles to minimize the error between the current and desired end effector positions. The Jacobian inverse or pseudo-inverse can be used to compute the necessary joint velocity changes.

  6. 6.What happens if a robotic arm encounters a singularity during motion?Application

    When a robotic arm encounters a singularity, it loses one or more degrees of freedom, making it difficult or impossible to move in certain directions. This can lead to large joint velocities or instability in the control system. To avoid singularities, path planning and control algorithms must be designed to detect and circumvent these configurations.

  7. 7.Calculate the joint angles for a 2D robotic arm with two links of lengths 1 m each, to reach a point (1, 1) in the plane.Numerical

    Distance to the target is √2 m, which is within the reach 0 to 2 m. cos θ2 = (x² + y² − L1² − L2²)/(2·L1·L2) = (2 − 1 − 1)/2 = 0, so θ2 = ±90°. θ1 = atan2(1, 1) − atan2(L2·sin θ2, L1 + L2·cos θ2): for θ2 = +90°, θ1 = 45° − 45° = 0°; for θ2 = −90°, θ1 = 45° + 45° = 90°. Both (0°, 90°) and (90°, −90°) reach (1, 1), the elbow-up and elbow-down solutions.

  8. 8.For a robotic arm with joint limits, how would you ensure the inverse kinematics solution respects these limits?Application

    To ensure the inverse kinematics solution respects joint limits, constraints can be incorporated into the solution algorithm. This can be done by checking each calculated joint angle against its limits and adjusting the solution iteratively. Optimization techniques or constrained solvers can also be used to find a feasible solution within the specified joint limits.

Finished this topic? Mark it so your progress, study plan and readiness keep up.

Stuck on something here?