Phase 01 · Week 2 · 120 minutes

Day 14: Jacobian intuition and bounded numerical inverse kinematics

Turn the maths into robot motion · Use angles, transforms, and kinematics to predict where a robot part will move.

Chapter 02 · Turn the maths into robot motion

Today in the field story

One problem, then the next

The operator now requests a camera target rather than supplying joint angles. Treat the Camera-Crane Recovery’s Jacobian as a local nudge map, estimate its columns with bounded finite differences, and attempt one reachable and one impossible target. Each iteration must respect joint limits, clamp the update, recompute FK residual, and stop on success, poor progress, or iteration budget.

Why now

A bounded inverse solver closes the chapter’s path from desired camera position back to joint configuration.

Ignore today

Ignore collision-free trajectory execution; an IK answer is geometry, not permission to move.

Unlocks next

MoveIt kinematics, local Servo reasoning, and explicit solver-failure handling.

Understand

Build the physical picture first

A Jacobian is a local nudge map. Nudge one joint a tiny known amount and watch the tool's tiny movement; collect one such movement per joint. Numerical inverse kinematics repeatedly uses that nearby map to choose the next safe nudge toward a target.

The Jacobian J connects small joint motion to small tool motion near the current configuration. In velocity form, x_dot≈J q_dot. Each column answers a concrete experiment: if this one joint moves at unit speed while other joints stay still, what tool velocity appears? The values and even usable directions change as the robot changes configuration.

A finite-difference Jacobian estimates each column without symbolic calculus. Run FK at q, increase one joint by a small ε, run FK again, subtract the tool positions, and divide by ε. Revolute-joint columns then carry units such as metres per radian. ε must be small enough to be local but not so tiny that floating-point or measurement noise dominates.

Numerical inverse kinematics starts with a guess q. It computes target error e=x_target-FK(q), obtains a Jacobian, chooses a limited update such as Δq=J⁺e, applies joint limits, and repeats. J⁺ is the pseudoinverse. Because the model is nonlinear, the first update is usually an approximation; the starting guess can lead to a different solution or no convergence.

A singular configuration loses instantaneous movement in at least one task direction, and a target can be unreachable because of link length, joint limits, or obstacles. A robust solver clamps each update, limits iterations and time, evaluates the final FK residual, and returns non-converged when the tolerance is not met. Damped least squares is often used near singularities, but damping reduces sensitivity rather than making impossible targets reachable.

IK output is not automatically a safe motion. A joint solution still needs collision, velocity, acceleration, torque, and workspace checks before a controller uses it. This lesson stops at bounded geometric search so the separation between pose solving and safe execution remains clear.

Words you need

Name each idea precisely

Jacobian

A configuration-dependent local map from joint rates to tool velocity.

Physical example:

A small elbow turn may move the hand mostly sideways in one pose and mostly upward in another.

Finite difference

A local slope estimate made from a small input change and observed output change.

Physical example:

Move one cardboard hinge by 1° and divide the tip displacement by that angle.

Inverse kinematics

Finding joint values that achieve a requested tool pose.

Physical example:

Choosing shoulder and elbow angles that place a gripper over a part.

Pseudoinverse

A generalized matrix inverse used for non-square, redundant, or singular local systems.

Physical example:

It can choose a smallest joint update when several local updates fit the same tool correction.

Singularity

A configuration where the Jacobian loses rank and the tool loses an instantaneous motion direction.

Physical example:

A fully stretched flat arm cannot create a tiny outward hand motion by infinitesimal joint rotation.

Residual

The remaining target error after an IK attempt.

Physical example:

The requested point is still 5 mm from the FK result after the final iteration.

Visual model

See the relationship

Swipe the technical canvas horizontally on a small screen.Jacobian intuition and bounded numerical inverse kinematics — failure diagramMark a target on graph paper, adjust two cardboard-arm joints to touch it, and verify the angles by calculating forward again. Unreachable target: No joint values can reach a point beyond the total link length. The displayed measure is -10 cm reach margin.joint / reach limitbasejointinvalid targetUnreachable target
Day 14 · Failure caseNo joint values can reach a point beyond the total link length. Measured anchor: -10 cm reach margin.

Math, one line at a time

Work through today’s relationship

Prerequisite rescue · optionalStart at zero: turns, triangles, and pose chains

A joint turn becomes a tool position only after we define the angle, split a link into horizontal and vertical parts, and follow frame order.

θ
theta: the amount a joint has turnedUnit: degrees (°) or radians (rad)
cos θ, sin θ
horizontal and vertical fractions of a turned unit linkUnit: no unit
Tᴬ_B
position and direction of frame B described by frame AUnit: unitless rotation + metres
  1. A full turn is 360° = 2π rad, so 90° × π/180 = π/2 rad. π is about 3.1416.

  2. For a 1 m link at 90°, x = 1 cos 90° = 0 m and y = 1 sin 90° = 1 m.

  3. For several frames, follow the physical path in order. Multiply transforms only when the touching frame names match, then verify by reversing the path.

Programmer analogy

Like nested UI transforms, each child inherits its parent's transform; unlike UI, the order can move metal into an obstacle.

What are x and y for a 2 m link at 0 rad?

x = 2 cos 0 = 2 m; y = 2 sin 0 = 0 m.

Estimate a local slope with

JijΔpiΔqj.J_{ij}\approx\frac{\Delta p_i}{\Delta q_j}.

Here Δ\Delta means “small change,” pip_i is one tool coordinate, and qjq_j is one joint. Update with a bounded step, then check residual

e=ptargetpFK.e=\lVert\mathbf p_{\text{target}}-\mathbf p_{\text{FK}}\rVert.

One bounded IK update for a two-link arm

Use two 1 m links, initial q=(0,π/2) rad, current FK point (1,1) m, and target (1.1,1.0) m.

  1. Compute error e=target-current=(0.1,0.0) m.

  2. Estimate or derive the local Jacobian at q: J=[[-1,-1],[1,0]] m/rad.

  3. Read its columns: a small shoulder turn moves the tip approximately (-1,+1) m per rad; a small elbow turn moves it (-1,0) m per rad.

  4. Solve J Δq=e, giving Δq≈(0,-0.1) rad; this respects a 0.1 rad step limit.

  5. Update q to approximately (0,1.4708) rad, or (0°,84.27°).

  6. Run FK again: point≈(1.0998,0.9950) m, so residual≈0.0050 m.

  7. Because 5 mm is above a hypothetical 1 mm tolerance, report 'continue' rather than success and compute another bounded iteration.

Result

One local update reduces 100 mm error to about 5 mm but has not yet met the 1 mm success condition.

What this proves

Every numerical IK success claim must be confirmed by running FK on the answer and comparing the residual with a declared tolerance.

Physical examples

Where this appears in real life

Human arm near full extension

Hold your hand still and compare tiny elbow/shoulder effects with the arm bent and nearly straight.

Look for:

Near full extension, joint turns mostly move the hand sideways; immediate outward motion becomes poorly available.

Excavator reaching a marked point

An operator repeatedly adjusts boom and stick by small amounts while watching bucket error.

Look for:

Each correction uses the local effect of the joints; a target beyond total reach remains impossible regardless of repeated nudges.

Hands-on exercise

Make the idea observable

Use the browser two-link arm visualizer or a short Python notebook with FK, plus one reachable and one unreachable target.

  1. Record link lengths, joint limits, starting q, frame, units, error tolerance, maximum iterations, and maximum joint step.

  2. Run FK at the starting q and compute target error.

  3. Perturb each joint by ε=0.01 rad, rerun FK, and build one finite-difference Jacobian column at a time.

  4. Compute a pseudoinverse or damped-least-squares update and clamp every joint step.

  5. Apply the update, enforce joint limits, and log iteration, q, residual, and clamp status.

  6. Stop only on tolerance, iteration/time budget, invalid numbers, or no useful progress.

  7. Repeat for the unreachable target and confirm the solver returns non-converged with final residual rather than false success.

Observe

Progress depends on starting pose and local geometry. Near singularity, updates can grow or improve little; bounded stopping makes this visible and safe.

Done when

The reachable target meets a declared tolerance, the unreachable target exits within budget, and both traces include final FK residual, iterations, limits, and status.

Build today

Extend the browser notebook into a two-link arm visualizer with frame composition, forward kinematics, and a bounded numerical IK trace.

Evidence to save

DONE when the weekly ship note explains how “Jacobian intuition and bounded numerical inverse kinematics” changed the build, what still fails, and the first task for next week.

Common mistakes

Catch the wrong mental model

Wrong

Assuming IK has one unique answer.

Better

Expect zero, one, or multiple solutions depending on geometry, constraints, and initial guess.

Wrong

Using an unbounded pseudoinverse update near a singularity.

Better

Use damping or another robust method, clamp steps, enforce limits, and stop on poor progress.

Wrong

Declaring success from small joint updates.

Better

Run FK and compare task-space residual with the declared tolerance.

Wrong

Sending an IK solution directly to hardware.

Better

Treat IK as geometry only; apply collision, dynamic, command, and safety checks before execution.

Job connection

How this becomes employable evidence

Manipulation software and field integration use Jacobians and IK to turn task-space targets into joint goals. Engineers diagnose non-convergence, poor initial guesses, frame errors, singular poses, and limit violations without converting them into unsafe commands.

Relevant target roles

  • Robotics Deployment, Integration & Validation Engineer
  • Robotics Application / ROS 2 Integration Engineer
  • Robotics Software Engineer — ROS 2 / AMR

Chapter 02 interview drill

Interview questions: Jacobian intuition and bounded numerical inverse kinematics

Practise a 60–90 second answer: define the idea, connect it to a physical robot, state assumptions, frames, and units when relevant, then finish with the failure signal or evidence you would inspect.

Primary interview scenario

Describe a bounded numerical IK loop. What does one Jacobian column mean, what can cause non-convergence, and what evidence is required before returning success?

Answer shape: clarify the situation → trace the physical and software path → test the most likely boundaries → name the evidence that would confirm the result.

Technical follow-up questions

Q1What does column j of a position Jacobian describe?
Model interview answer

The local tool-velocity contribution when joint j moves at unit rate and the other joints have zero rate.

Q2Why does the Jacobian need recalculation during iterative IK?
Model interview answer

It is a local map that changes with the robot configuration.

Q3What must a failed solver return?
Model interview answer

A bounded non-converged status plus final residual, iterations/time, active limits, and any known failure cause.

Chapter starter artifact

Check camera-crane geometry and bounded reach

A two-link camera-crane notebook predicts three measured tool poses, validates rotation and SE(3) invariants, composes and inverts the frame chain, and returns explicit SUCCESS or UNREACHABLE IK evidence with limits and residuals.

week-02-camera-crane.mjsLanguage: JavaScriptDownload starter
const mission = "camera-crane";
const links = [1, 1];
const joints = [0, Math.PI / 2];
const fk = ([a, b]) => [
  links[0] * Math.cos(a) + links[1] * Math.cos(a + b),
  links[0] * Math.sin(a) + links[1] * Math.sin(a + b),
];
const point = fk(joints);
const translation = [0.3, -0.2];
const forward = point.map((value, index) => value + translation[index]);
const backward = forward.map((value, index) => value - translation[index]);
const roundTripError = Math.hypot(
  backward[0] - point[0],
  backward[1] - point[1],
);
const target = [3, 0];
const reachable = Math.hypot(target[0], target[1]) <= links[0] + links[1];
const numericContract = links.concat(joints, translation, target).every(Number.isFinite);
if (!numericContract || links.some((value) => value <= 0) ||
    roundTripError > 1e-9) throw new Error("invalid geometry");
console.log("mission=" + mission);
console.log("fk=(" + point.map((value) => value.toFixed(3)).join(",") + ")m");
console.log("roundTripError=" + roundTripError.toFixed(6) + "m");
console.log("ikStatus=" + (reachable ? "READY_TO_SOLVE" : "UNREACHABLE"));
console.log("status=PASS");

Download the file into your terminal's current folder, then run the command below. The expected output is exact.

Run

node week-02-camera-crane.mjs

Expected output

mission=camera-crane fk=(1.000,1.000)m roundTripError=0.000000m ikStatus=UNREACHABLE status=PASS

Planted failure to diagnose

Apply translation before rotation in the physical tray exercise, or reverse only the translation when inverting a rotated transform. The identity round-trip check must then expose a nonzero residual.

Topic reference