Section 5.6: Inverse kinematics: analytic, numerical (Jacobian), and learned

A Careful Control Loop
Big Picture

Inverse kinematics: analytic, numerical (Jacobian), and learned is one lens on kinematics and robot motion. We study it because an embodied agent needs decisions that survive contact with noisy sensors, delayed effects, and changing environments.

This section develops the technical contract for Inverse kinematics: analytic, numerical (Jacobian), and learned into a usable mental model. First we define the object of study, then we connect it to the agent loop, then we test it with a compact implementation.

The key question in Inverse kinematics: analytic, numerical (Jacobian), and learned is practical: what must the agent know, what can it observe, what action is available, and what evidence shows that the action worked under the stated conditions?

Action Is The Test

A representation earns its place when it changes the measurable action interface. In Inverse kinematics: analytic, numerical (Jacobian), and learned, the reader should keep asking which decision becomes easier, safer, or more reliable.

Theory

For Inverse kinematics: analytic, numerical (Jacobian), and learned, the practical design rule is to make the interface inspectable before optimization begins: inputs, outputs, units, latency, bounds, and failure labels should all be visible in the saved artifact.

Inverse kinematics asks the harder direction: given a desired tool pose, which joint vector should produce it? The answer may be unique, absent, or one of many valid configurations. That is why every inverse-kinematics result must report the target frame, seed, residual, joint-limit margin, and whether the solver proved feasibility or merely stopped improving.

Analytic IK uses closed-form geometry when the arm structure permits it. Numerical IK iteratively reduces pose error with a Jacobian update. Learned IK uses data to predict candidate joint values, but still needs forward-kinematics and constraint checks because a neural prediction can be confident and infeasible at the same time.

Mechanism

The mechanism in Inverse kinematics: analytic, numerical (Jacobian), and learned is the contract between representation and action. Name what enters the module, what leaves it, which assumptions make that transformation valid, and which log would reveal a bad handoff.

Worked Example

The example solves position IK for the planar two-link arm from Section 5.5 with the damped least-squares update $\Delta q=J^\top(JJ^\top+\lambda^2 I)^{-1}\Delta x$, then replays the solution through forward kinematics to confirm the reached pose. Damping keeps the step bounded when the arm stretches toward a near-singular reach.

import numpy as np

l1, l2 = 0.5, 0.4

def fk(q):
    x = l1*np.cos(q[0]) + l2*np.cos(q[0]+q[1])
    y = l1*np.sin(q[0]) + l2*np.sin(q[0]+q[1])
    return np.array([x, y])

def jacobian(q):
    s1, s12 = np.sin(q[0]), np.sin(q[0]+q[1])
    c1, c12 = np.cos(q[0]), np.cos(q[0]+q[1])
    return np.array([[-l1*s1 - l2*s12, -l2*s12],
                     [ l1*c1 + l2*c12,  l2*c12]])

def ik_dls(target, q0, lam=0.05, iters=200, tol=1e-6):
    q = q0.astype(float).copy()
    for k in range(iters):
        dx = target - fk(q)
        if np.linalg.norm(dx) < tol:
            return q, k, np.linalg.norm(dx), True
        J = jacobian(q)
        dq = J.T @ np.linalg.solve(J @ J.T + lam**2*np.eye(2), dx)
        q += np.clip(dq, -0.2, 0.2)          # clamp per-step joint increment
    return q, iters, np.linalg.norm(target - fk(q)), False

target = np.array([0.6, 0.3])
q_sol, iters, res, ok = ik_dls(target, q0=np.deg2rad([10.0, 10.0]))
print("converged:", ok, "iters:", iters, "residual:", f"{res:.2e}")
print("solution (deg):", np.round(np.rad2deg(q_sol), 3))
print("FK replay      :", np.round(fk(q_sol), 6), "target:", target)

# Unreachable target (beyond l1+l2 = 0.9 m): solver must NOT report success
_, _, res_far, ok_far = ik_dls(np.array([1.5, 0.0]), q0=np.deg2rad([10.0, 10.0]))
print("far target -> converged:", ok_far, "residual:", f"{res_far:.3f} m")

The FK replay closes the loop: a solver that returns its last iterate without checking the residual would silently pass the unreachable target. Reporting convergence flag, residual, and an FK replay together is what separates a usable IK result from a stopped optimizer.

Library Shortcut

The inverse-kinematics fragment should expose residual, seed, joint limits, damping, convergence status, and unreachable targets. MoveIt 2, Drake, and Pinocchio are production tools, but the small solve explains failure.

Practical Recipe

  1. Write the observation, action, and success metric before choosing a model.
  2. Build a baseline that is simple enough to debug by inspection.
  3. Add the library implementation only after the baseline behavior is understood.
  4. Record failures as structured cases: perception error, state error, planning error, control error, or evaluation error.
  5. Run at least one perturbation test before trusting the result.
Common Failure Mode

The common mistake in Inverse kinematics: analytic, numerical (Jacobian), and learned is to celebrate the component score before checking the closed-loop handoff. The failure usually appears at the boundary: stale state, wrong frame, delayed action, saturated actuator, or metric that ignores the real task cost.

Practical Example

A robotics team using Inverse kinematics: analytic, numerical (Jacobian), and learned should log not only final success, but intermediate observations, chosen actions, controller status, and recovery events. The logs reveal whether the method is solving the task or merely passing the easiest episodes.

Memory Hook

When inverse kinematics: analytic, numerical (jacobian), and learned feels abstract, ask what would be different in the next frame of video, the next robot state, or the next safety margin.

Research Frontier

For Inverse kinematics: analytic, numerical (Jacobian), and learned, treat frontier claims as hypotheses until they expose enough detail to reproduce the result: data boundary, embodiment, controller interface, evaluation panel, and failure cases.

Self Check

Can you name the observation, state estimate, action, success metric, and most likely failure mode for Inverse kinematics: analytic, numerical (Jacobian), and learned? If not, the system boundary is still too vague.

Production Pattern

Inverse kinematics: analytic, numerical (Jacobian), and learned sits inside the Part II robotics contract: geometry defines where things are, kinematics defines what motion is possible, dynamics defines what motion costs, control defines how errors are corrected, and sensing defines what the agent can know on time.

Treat inverse kinematics as constrained search, with residuals, limits, seeds, and infeasibility explicitly logged. This makes the section useful to students, builders, and researchers at the same time: the idea has an intuitive role, a formal interface, a runnable check, and a failure mode that can be reproduced.

Mechanism To Watch

For Inverse kinematics: analytic, numerical (Jacobian), and learned, kinematics maps joint or body motion into task-space motion without explaining forces. Preserve joint limits, frame conventions, velocity units, and singularity margins in the artifact.

Library Choices And Verification Checks
Tool or LibraryWhat It HandlesVerification Check
Pinocchiocomputes articulated-body kinematics, dynamics, and derivativesVerify model frames, joint ordering, and derivative convention against the URDF.
Robotics Toolbox for Pythonsupports practical work on Inverse kinematics: analytic, numerical (Jacobian), and learnedVerify the library output against the hand-built baseline on one small case.
MoveIt 2supports practical work on Inverse kinematics: analytic, numerical (Jacobian), and learnedVerify the library output against the hand-built baseline on one small case.
Drakemodels dynamical systems, multibody plants, optimization, and controllersVerify scalar type, plant finalization, frame convention, and solver status.
ROS 2 controlsupports practical work on Inverse kinematics: analytic, numerical (Jacobian), and learnedVerify the library output against the hand-built baseline on one small case.

Use this recipe when turning Inverse kinematics: analytic, numerical (Jacobian), and learned into code, a simulator experiment, or a robot diagnostic. The point is not to use every library. The point is to keep the hand-built baseline and the maintained-tool path comparable.

  1. Write the joint vector, frame target, velocity convention, and constraint set before solving.
  2. Check forward kinematics on a known posture, then perturb one joint and inspect the end-effector delta.
  3. Compare an analytic or numerical Jacobian with Pinocchio, Robotics Toolbox, or Drake on the same robot model.
  4. Log residual error, joint-limit distance, manipulability, and solver iteration count in one artifact.
  5. Treat singularities and infeasible targets as design signals, not as solver annoyances.
Evidence Gate

For Inverse kinematics: analytic, numerical (Jacobian), and learned, compare methods only through one saved artifact that preserves the inputs, outputs, units, timestamps, latency budget, configuration, seed, metric definition, and failure labels relevant to this section. The comparison is meaningful only when the same script evaluates the same panel.

Exercise Extension

Extend the section exercise by adding one perturbation specific to Inverse kinematics: analytic, numerical (Jacobian), and learned and one latency or uncertainty check. Save the result in the EvidenceRecord schema, then explain which library output you trust and why.

Kinematic failures often arrive as a plausible pose with an impossible motion. Inspect target reachability, seed choice, residual definition, joint limits, damping, and frame convention before blaming the planner. For this section, first reproduce one planar inverse-kinematics target by hand, then rerun it through Pinocchio, Robotics Toolbox for Python, MoveIt 2, Drake, or a learned candidate generator with a forward-kinematics verifier. If the two disagree, inspect conventions and timing before changing the model.

Technical Core

Inverse kinematics: analytic, numerical (Jacobian), and learned needs a topic-native core: variables, equations or system contracts, an algorithmic procedure, an expected output, and a failure diagnosis. Figure 5.6.T summarizes the chain this section must preserve when moving from a teaching example to a real embodied system.

Technical core for Inverse kinematics: analytic, numerical (Jacobian), and learned A block diagram connecting assumptions, model, algorithm, evidence, and failure analysis for Inverse kinematics: analytic, numerical (Jacobian), and learned. Assumptions frames, units, limits Model kinematics and robot motion Algorithm update or plan Evidence trace, metric Failure diagnosis Graduate-depth contract: define variables, run the method, interpret output, and explain when it fails. This diagram marks the minimum technical chain the section must make explicit.
Figure 5.6.T: The technical core for Inverse kinematics: analytic, numerical (Jacobian), and learned connects assumptions, model, algorithm, evidence, and failure analysis.
Formal Object

Given $T^\star$, find $q$ such that $T_{0e}(q)\approx T^\star$, while satisfying $q_{\min}\le q\le q_{\max}$ and any task constraints. A common numerical update is $\Delta q=J^\top(JJ^\top+\lambda^2 I)^{-1}\Delta x$.

The residual $\Delta x$ must be expressed in the same frame as the Jacobian. The damping term $\lambda$ trades speed for stability near singularities, and the seed $q_0$ influences which branch or redundant posture the solver finds.

Damped least-squares inverse kinematics
  1. Represent the desired end-effector task as a pose error in the same frame as the Jacobian.
  2. Compute the geometric or analytic Jacobian at the current joint vector and choose damping from the smallest singular value.
  3. Solve the damped least-squares update, clamp joint increments, and enforce joint limits after every iteration.
  4. Forward-propagate the candidate with forward kinematics and log residual task error, condition number, seed, branch, and saturation events.
  5. For learned IK, treat the model output as a seed or candidate set, then run the same forward-kinematics and constraint checks.
Technical Contract For Inverse kinematics: analytic, numerical (Jacobian), and learned
Contract FieldWhat To SpecifyWhy It Matters
State and observationVariables, units, timestamps, frames, and uncertainty.Prevents a model score from being mistaken for robot capability.
Action interfaceCommand type, limits, update rate, and safety fallback.Makes the learned or planned output executable.
Evidence artifactTrace, metric, configuration, seed, and failure label.Allows baseline and library path to be compared in one pass.
Tool pathModern Robotics, Pinocchio, Drake, ROS 2 tf2, MoveIt, NumPyShows the practical library route after the mechanism is understood.

Expected output is a bounded joint vector, a residual below the task tolerance, a forward-kinematics replay of the reached pose, and a clear infeasibility label when no solution exists. A residual that grows after damping usually means the error vector and Jacobian use different frames.

Failure Mode To Test

Inverse kinematics fails when the solver reports the last iterate as success, a learned model predicts joints outside limits, a redundant arm drifts into a joint limit, or the algorithm reduces position error while making orientation impossible.

Section References

Core references for Inverse kinematics: analytic, numerical (Jacobian), and learned: Modern Robotics; Murray, Li, and Sastry; Siciliano et al.; LaValle; and official documentation for Drake, MuJoCo, Pinocchio, CasADi, python-control, GTSAM, ROS 2, and OpenCV as applicable.

Use these references to check notation, frame conventions, units, solver assumptions, and maintained-library behavior.

Key Takeaway

Inverse kinematics: analytic, numerical (Jacobian), and learned is useful when it makes the perception-action loop more reliable, not when it merely adds a more impressive model name.

Exercise 5.6.1

Design a method-matched experiment for Inverse kinematics: analytic, numerical (Jacobian), and learned. Specify the environment, observations, actions, metric, one perturbation, and the library output you would compare against the hand-built baseline.