Nyimbi Odero

Series 01 · a numbered run · kept in public

Lesson 2.3.3 — Contact-Rich Manipulation

Chapter: Phase 2 — The Core Loop: Perception, Learning, and Control at Depth · Module 2.3 — Grasping and Advanced Manipulation

Week 14

Prerequisite lessons: 2.3.1 (grasp synthesis and quality), 2.3.2 (motion planning for manipulation), 2.2.4 (offline-to-online fine-tuning), 2.1.5 (visual SLAM and odometry), 1.1.3 (PID, computed torque, trajectory tracking), 1.1.4 (the full-stack pick-and-place pipeline).

Prior results used in this lesson. From 1.1.3: the computed-torque law τ=M(q)(q¨d+Kde˙+Kpe)+Cq˙+g(q)\tau = M(q)(\ddot q_d + K_d \dot e + K_p e) + C \dot q + g(q) and the fact that it was derived with zero external force. From 2.3.1: force closure and the Ferrari–Canny ε\varepsilon grasp-quality metric. From 2.3.2: a collision-free path with a clearance margin. From 2.2.4: the runtime Q-shield and the deploy–collect–fine-tune loop. From 2.1.5: the eye-in-hand relative-pose estimator and the kinematic prior TWC(q)=TWE(q)TECT_W^C(q) = T_W^E(q) T_E^C. Each is restated at the point of use.

What this lesson hands forward. The contact model, the impedance/admittance control law, and the residual-learning architecture that Lesson 3.1.4 (VLA fine-tuning) extends to pre-trained policies, and that Module 4.2 (building the full-stack agent) uses as the policy layer beneath the reasoning layer.

The running case in one sentence. The same 6-DOF arm carries the same parallel-jaw gripper over the same table; it must grasp the 5 cm, 0.1 kg cube at TWObj=(Rz(π/4),[0.5,0.2,0.3])T_W^{Obj} = (R_z(\pi/4), [0.5, 0.2, 0.3]) with friction coefficient μ=0.5\mu = 0.5, carry it past the divider at x=0.35x = 0.35, and release it into the bin at [0.4,−0.3,0.15][0.4, -0.3, 0.15] — and every one of those steps is a contact event.


§L.0 — Lesson map, objectives, and misconceptions

PartContentLab stepWord budget
AWhy contact breaks the position-control pipelineMeasure the steady-state error under contact1,600
BContact models, the friction cone, grasp forceCompute the grasp force budget1,700
CImpedance and admittance controlImplement a torque-level impedance controller1,700
DLearning contact-rich policiesTrain a residual policy in simulation1,500
ERunning case: detection, recovery, fusionIntegrate detection and recovery into the pipeline1,600

Observable outcomes. By the end of this lesson you can, without notes: (1) derive the steady-state position error of the 1.1.3 controller under a constant contact wrench; (2) state the Signorini complementarity and Coulomb friction conditions; (3) compute the minimum grip force for a misaligned grasp; (4) explain why contact stiffness makes high-gain position control unstable; (5) write the torque-level impedance control law and compute the rendered Cartesian stiffness; (6) choose impedance or admittance control from the environment stiffness; (7) describe hybrid position/force control and its selection matrix; (8) design a residual-RL policy on top of an impedance controller with a clipped action; (9) specify domain-randomization ranges from identification uncertainty; (10) budget the grasp force across the pick-and-place and design a contact-detection and recovery sequence.

Misconception inventory.

Wrong modelWhy attractiveWhere displacedCorrect model
Contact is a disturbance that high-gain position control rejects.Disturbance rejection is the standard story for PID.§L.A.1Contact is a mode change in the plant; high gain turns force into instability, not rejection.
More grip force is always safer.Friction scales with normal force.§L.B.2Excess grip force crushes the object, saturates the sensor, and deforms the grasp geometry.
Force control is position control with a different gain.Both are PID loops.§L.C.2Force control has a different loop topology: the controlled and measured variables are forces.
Learning replaces the controller.End-to-end RL is the headline result.§L.D.1Learning complements control; the base controller bounds the action and the residual learns the correction.
Contact detection needs a dedicated force sensor.Wrist F/T sensors are the obvious instrument.§L.E.2A momentum observer on joint torque or motor current estimates the external wrench without a dedicated sensor.

Everything is self-contained. Where a prerequisite lesson is used, the result is restated at the point of use.


§L.0.5 — Retrieval warm-up

Q1. In 1.1.3, the computed-torque law cancels the nonlinear terms Cq˙+g(q)C\dot q + g(q) and imposes a linear error dynamics. Under what assumption was that derivation made?

Answer. The derivation assumed no external force at the end-effector, so the plant was Mq¨+Cq˙+g=τM\ddot q + C\dot q + g = \tau. Used in §L.A.1 to show that the assumption is exactly what contact violates.

Q2. In 2.3.1, a grasp is force-closed if every external wrench can be resisted by contact forces inside the friction cones. What quantity does the ε\varepsilon metric measure?

Answer. The radius of the largest ball centered at the origin of the grasp wrench space that fits inside the set of achievable wrenches under the linearized friction cones (Ferrari & Canny 1992, tier A, S). Used in §L.B.1 to connect force closure to a computable number.

Q3. In 2.3.2, a planned path carries a clearance margin. What does the margin protect against, and what invalidates it?

Answer. It protects against model error and control tracking error; it is invalidated when the payload’s actual swept volume exceeds the planned one, for example when the object slips or swings in the grasp. Used in §L.E.1 to explain why transport swing threatens the divider clearance.

Q4. In 2.1.5, the eye-in-hand camera’s pose is available from forward kinematics through TWC(q)=TWE(q)TECT_W^C(q) = T_W^E(q) T_E^C. What does that estimate not give during a grasp?

Answer. It gives the gripper pose but not the object pose: if the object slips in the grasp, the camera moves with the gripper while the object does not. Used in §L.E.2 to motivate visual object tracking during contact.


Part A — Why contact breaks the position-control pipeline

§L.A.1 — The plant changes when contact begins

The controller from 1.1.3 was derived from the manipulator dynamics with no external force:

M(q)q¨+C(q,q˙)q˙+g(q)=τ.M(q)\ddot q + C(q,\dot q)\dot q + g(q) = \tau .

When the end-effector touches the environment, an external wrench FextF_{ext} acts at the contact point and enters through the Jacobian transpose:

M(q)q¨+C(q,q˙)q˙+g(q)=τ+J(q)⊤Fext.M(q)\ddot q + C(q,\dot q)\dot q + g(q) = \tau + J(q)^\top F_{ext}.

This is the only change, and it invalidates the 1.1.3 derivation. Substitute the computed-torque law τ=M(q)(q¨d+Kde˙+Kpe)+Cq˙+g(q)\tau = M(q)(\ddot q_d + K_d \dot e + K_p e) + C\dot q + g(q) with e=qd−qe = q_d - q:

Mq¨=M(q¨d+Kde˙+Kpe)+J⊤Fext.M\ddot q = M(\ddot q_d + K_d \dot e + K_p e) + J^\top F_{ext}.

Since e¨=q¨d−q¨\ddot e = \ddot q_d - \ddot q,

e¨+Kde˙+Kpe=−M−1J⊤Fext.(A.1)\ddot e + K_d \dot e + K_p e = -M^{-1} J^\top F_{ext}. \tag{A.1}

The right-hand side is the contact wrench mapped into joint space and scaled by the inverse inertia. At steady state with constant FextF_{ext}, e˙=e¨=0\dot e = \ddot e = 0, so

ess=−Kp−1M−1J⊤Fext.(A.2)e_{ss} = -K_p^{-1} M^{-1} J^\top F_{ext}. \tag{A.2}

The contact force appears as a position error. The controller has no way to distinguish “the arm is being pushed” from “the arm is behind its reference.” Its only mechanism for generating force is to be displaced, so it settles at the displacement that produces exactly the force the environment demands. This is the algebraic statement of the first misconception: contact is not a disturbance to be rejected, it is a new equilibrium.

The effective Cartesian stiffness of the robot is Kx=KpMK_x = K_p M in the simplest case. In series with the contact stiffness kck_c, the force produced by a commanded penetration dd is

F=(1Kx+1kc)−1d  ≈  Kx dwhen Kx≪kc.(A.3)F = \left( \frac{1}{K_x} + \frac{1}{k_c} \right)^{-1} d \;\approx\; K_x \, d \quad \text{when } K_x \ll k_c. \tag{A.3}

So the robot’s own stiffness sets the force, not the contact’s. This is the seed of impedance control: if the robot’s rendered stiffness determines the force, then rendering a chosen stiffness is a way to choose the force.

Self-explanation 1. In one sentence, why is the steady-state position error proportional to the contact force?

Answer. Because the controller’s only mechanism for generating force against the environment is a position error acting through the robot’s stiffness Kx=KpMK_x = K_p M.

Self-explanation 2. Why does a high-gain position controller against a stiff environment become unstable rather than accurate?

Answer. Raising KpK_p raises the loop gain and pushes the contact poles toward the contact natural frequency ωc=kc/m\omega_c = \sqrt{k_c/m}; once the controller bandwidth approaches ωc\omega_c, sampling delay erases the phase margin.

§L.A.2 — Impacts, friction, and the four failure modes of position control

Three further properties of contact defeat position control.

Impacts are open-loop. When the end-effector first touches a surface with normal velocity vn−v_n^-, the velocity jumps to vn+=−e vn−v_n^+ = -e\, v_n^- for coefficient of restitution ee. The impulse is delivered over a duration of order the contact’s natural period, typically well under a millisecond for stiff materials. A controller sampling at 1 kHz sees the impact as a single-sample event; it cannot modulate the force. The only defence is to arrive with low normal velocity.

Friction is set-valued. At zero tangential velocity, the friction force may be any vector inside the friction cone; the Coulomb model does not specify which. This non-uniqueness breaks the differentiability that gradient-based learning and linear control both rely on. The maximum-dissipation principle selects a unique force during sliding, but not during sticking.

The plant is hybrid. Free motion, sticking contact, sliding contact, and impact are four distinct dynamical modes. A controller designed for one mode is not automatically valid in another. Robustness requires either a controller that is safe in all modes (impedance control, Part C) or explicit mode detection and switching (Part E).

Concept check. A learner adds integral action to the 1.1.3 controller to eliminate the steady-state error of Eq. (A.2). What happens to the contact force, and why is the fix wrong?

Answer. The integrator sees a persistent position error — the environment holds the arm back — and keeps increasing the command until the force saturates or the object deforms. The steady-state position error goes to zero, but the force becomes whatever the environment demands, which can be arbitrarily large. The mechanism is integrator windup against a stiff constraint. [displaces M1]

Worked-example ladder.

WE-L.A.a (fully worked). Take M=IM = I, Kp=100IK_p = 100 I, J=IJ = I, and a constant contact force Fext=[5,0,0]⊤F_{ext} = [5, 0, 0]^\top N. Compute the steady-state error and the robot’s Cartesian stiffness.

Solution. From Eq. (A.2), ess=−100−1⋅5=−0.05e_{ss} = -100^{-1} \cdot 5 = -0.05 m along xx. The robot must be displaced 5 cm to generate 5 N. Its Cartesian stiffness is Kx=KpM=100K_x = K_p M = 100 N/m. To generate the same 5 N with a stiffer loop, Kp=10,000K_p = 10{,}000, the displacement would be 0.5 mm — but see the next rung.

WE-L.A.b (completion). With Kp=10,000K_p = 10{,}000, Kx=10,000K_x = 10{,}000 N/m and the contact stiffness is kc=105k_c = 10^5 N/m. Compute the effective series stiffness from Eq. (A.3) and the contact natural frequency for a 1 kg effective mass. Is the loop margin adequate?

Completion. Keff=(1/104+1/105)−1=9,091K_{eff} = (1/10^4 + 1/10^5)^{-1} = 9{,}091 N/m. The contact natural frequency is ωc=(Kx+kc)/m=1.1×105≈332\omega_c = \sqrt{(K_x + k_c)/m} = \sqrt{1.1 \times 10^5} \approx 332 rad/s. The controller bandwidth is roughly Kx/m≈100\sqrt{K_x/m} \approx 100 rad/s, within a factor of 3.3 of ωc\omega_c; with 1 kHz sampling and a few milliseconds of delay, the phase margin at crossover is thin. The lesson: reducing the 5 cm error to 0.5 mm by raising gain buys accuracy at the cost of stability.

WE-L.A.c (faded). Derive the closed-loop characteristic equation for the 1-DOF case with contact spring kck_c, controller stiffness KxK_x, and a pure delay TdT_d. Faded step: the loop is ms2=−Kx(e−sTd−1)−kcm s^2 = -K_x(e^{-s T_d} - 1) - k_c about the contact equilibrium; linearize the delay as 1−sTd1 - s T_d and find the critical KxK_x. The completion shows that the critical gain falls as 1/Td1/T_d, so faster sampling buys stability margin. The lesson: contact stability is a sampling-rate problem as much as a gain problem.

WE-L.A.d (contrastive near-miss). A learner observes that the arm chatters at about 300 Hz against the cube and concludes that the force sensor is noisy. Replacing the sensor does not help. Why it fails: the chatter frequency matches ωc/2π≈53\omega_c/2\pi \approx 53 Hz for kc=105k_c = 10^5 and m=1m = 1… the observed 300 Hz corresponds to a stiffer contact, kc≈3.5×106k_c \approx 3.5 \times 10^6 N/m, consistent with the metal fingers contacting the cube’s hard plastic corners rather than the rubber pads. The fix: lower KpK_p until the loop bandwidth is at least a factor of five below ωc\omega_c, or switch to impedance control. The near-miss teaches that chatter frequency is a diagnostic for contact stiffness, not for sensor noise.

Comparative table: control modes in contact.

ModeControlled variableMust measureFails when
PositionJoint or Cartesian positionEncodersEnvironment stiffness approaches robot stiffness
ForceContact forceForce or torqueContact is lost
ImpedanceDynamic motion-force relationPosition, optionally forceRendered impedance is non-passive
AdmittanceMotion response to forceForceEnvironment is soft

Design principle P33.1. Regulate mechanical impedance, not position, whenever contact is expected. Position control treats force as an error to be eliminated; impedance control treats force and motion as a relation to be shaped.


Consolidation checkpoint 1

(a) Three capabilities. You can derive Eq. (A.2) and interpret it. You can compute the series stiffness of robot and contact. You can diagnose chatter frequency as a contact-stiffness signature.

(b) Transfer probe. A 2 kg payload is held by a position-controlled arm with Kx=5000K_x = 5000 N/m against a spring-loaded fixture of stiffness 2×1042 \times 10^4 N/m. What steady-state force does a 2 mm commanded penetration produce? Answer: Keff=(1/5000+1/20000)−1=4000K_{eff} = (1/5000 + 1/20000)^{-1} = 4000 N/m, so F=8F = 8 N.

(c) Remediation rule. If you cannot explain why the steady-state error is proportional to force, re-derive Eq. (A.2) before Part B.


Part B — Contact models and the friction cone

§L.B.1 — Rigid contact: complementarity, Coulomb friction, force closure

A rigid contact between the finger and the cube is described by three conditions at each contact point.

Non-penetration and non-adhesion (Signorini). Let ϕ(q)≥0\phi(q) \ge 0 be the gap between the bodies. Then

ϕ≥0,λn≥0,ϕ λn=0,(B.1)\phi \ge 0, \qquad \lambda_n \ge 0, \qquad \phi \, \lambda_n = 0, \tag{B.1}

where λn\lambda_n is the normal force. The three conditions say: bodies do not interpenetrate, contact can only push, and force is nonzero only when the gap is zero. The product condition is a complementarity constraint; it makes the contact a hybrid system by construction.

Coulomb friction. The tangential force λt\lambda_t satisfies

∣λt∣≤μλn,(B.2)|\lambda_t| \le \mu \lambda_n, \tag{B.2}

and during sliding it opposes the slip velocity with maximum magnitude: λt=−μλn vt/∣vt∣\lambda_t = -\mu \lambda_n \, v_t / |v_t|. Equation (B.2) defines the friction cone: the set of admissible contact forces is a cone with apex at the contact point, half-angle arctan⁡μ\arctan \mu.

Force closure. Restating the result of 2.3.1: stack the contact forces into λ\lambda and form the grasp matrix GG so that the object wrench is w=Gλw = G\lambda. The grasp is force-closed if for every wrench ww there exists λ\lambda inside the friction cones with Gλ=−wG\lambda = -w. The ε\varepsilon metric of Ferrari & Canny (1992, tier A, S) is the radius of the largest ball centered at the origin of the wrench space that fits inside the achievable set; it is computed as a linear program once the cones are linearized.

Linearizing the cone. Replace the disc ∣λt∣≤μλn|\lambda_t| \le \mu \lambda_n with a polygon of mm edges with directions did_i:

λt=∑i=1mβidi,βi≥0,∑i=1mβi≤μλn.(B.3)\lambda_t = \sum_{i=1}^{m} \beta_i d_i, \qquad \beta_i \ge 0, \qquad \sum_{i=1}^{m} \beta_i \le \mu \lambda_n. \tag{B.3}

The linearization turns force-closure testing and grasp-force optimization into linear programs, at the cost of a conservative inner approximation (Anitescu & Potra 1997, tier A, S).

Self-explanation 3. Why is the set of admissible contact forces a cone rather than a bounded set?

Answer. Because the tangential limit scales with the normal force, which is unbounded above; scaling any admissible force by a positive factor keeps it admissible.

§L.B.2 — Soft contact models and the stiffness scale

Simulators rarely solve the complementarity conditions exactly. MuJoCo and most physics engines use a soft contact model in which the normal force is a function of penetration. The simplest is the penalty model

Fn=max⁡(0,  kcϕ+bcϕ˙),(B.4)F_n = \max\left(0,\; k_c \phi + b_c \dot\phi\right), \tag{B.4}

and the energy-consistent variant of Hunt & Crossley (1975, tier A, S) replaces the linear damping with a penetration-dependent term. The penalty model is simple but imposes a timestep constraint: the simulation must resolve the contact natural frequency, so Δt≪2/ωc\Delta t \ll 2/\omega_c with ωc=kc/m\omega_c = \sqrt{k_c/m}. For kc=105k_c = 10^5 N/m and m=0.1m = 0.1 kg, ωc≈1000\omega_c \approx 1000 rad/s and the timestep must be well below 2 ms; MuJoCo defaults to 2 ms with implicit integration that tolerates stiffer contacts than an explicit integrator would.

The stiffness scale matters for control. At a 5 N grip force with kc=105k_c = 10^5 N/m, the penetration is δ=F/kc=50 μ\delta = F/k_c = 50\ \mum. That is below the repeatability of most arms and comparable to the resolution of a good force sensor. The encoder cannot see the contact; the force sensor can. This is the practical reason force sensing, or force estimation, is mandatory for contact-rich work.

Worked-example ladder.

WE-L.B.a (fully worked). The cube is rotated by Rz(π/4)R_z(\pi/4), so its grasped faces have normals at 45∘45^\circ to the world axes. The gripper closes along world yy, so the finger force FF has normal component Fcos⁡θF\cos\theta and tangential component Fsin⁡θF\sin\theta at the contact, with θ=45∘\theta = 45^\circ. Compute the minimum finger force to hold the cube at rest, with m=0.1m = 0.1 kg, μ=0.5\mu = 0.5, and two fingers.

Solution. The available friction at each contact is μFcos⁡θ\mu F \cos\theta. Two contacts must carry the weight: 2μFcos⁡θ≥mg2 \mu F \cos\theta \ge mg. So

F≥mg2μcos⁡θ=0.9812⋅0.5⋅0.7071=1.39 N.(B.5)F \ge \frac{mg}{2\mu\cos\theta} = \frac{0.981}{2 \cdot 0.5 \cdot 0.7071} = 1.39\ \text{N}. \tag{B.5}

The standard 5 N grip force gives a margin of 5/1.39≈3.65/1.39 \approx 3.6.

WE-L.B.b (completion). Include a transport acceleration a=2a = 2 m/s² along the direction that adds to gravity. Compute the required finger force and the margin at 5 N.

Completion. Replace gg with g+a=11.81g + a = 11.81 m/s²: F≥0.1⋅11.81/0.7071=1.67F \ge 0.1 \cdot 11.81 / 0.7071 = 1.67 N. Margin at 5 N is 5/1.67=3.05/1.67 = 3.0. The completion shows that the acceleration term costs about 20% of the margin at a=2a = 2 m/s².

WE-L.B.c (faded). Linearize the friction cone with four edges and write the force-closure linear program for the planar two-contact grasp. Faded step: the constraints are Gλ=−wG\lambda = -w, βi≥0\beta_i \ge 0, ∑βi≤μλn\sum \beta_i \le \mu \lambda_n at each contact. The completion shows that the planar grasp is force-closed iff the line joining the two contacts lies inside the friction cone at both contacts — the “friction-cone-of-the-line” condition. For θ=45∘\theta = 45^\circ, μ=0.5\mu = 0.5, the half-angle is arctan⁡0.5=26.6∘<45∘\arctan 0.5 = 26.6^\circ < 45^\circ, so the rotated grasp is not force-closed against arbitrary wrenches in the plane; it is closed only against wrenches whose direction lies within the cone. This is the precise reason the rotated grasp is weaker than the aligned one.

WE-L.B.d (contrastive near-miss). A learner computes the grip force from μ\mu alone (taking θ=0\theta = 0) and obtains 0.98 N; in experiment the cube slips at 1.2 N. The discrepancy is attributed to “noisy friction.” Why it fails: the actual contact is at the cube’s corners rather than the face centres, so the effective θ\theta is larger than 45∘45^\circ and there is an additional moment arm about the grasp axis. The real requirement is closer to 1.7 N, matching the observed slip at 1.2 N only when the corner geometry and the moment are included. The fix: use the contact geometry from the grasp planner (2.3.1) rather than assuming face-centre contact, or instrument the fingers with tactile sensing to measure the actual contact patch.

Comparative table: contact models.

ModelForce lawCostStability requirement
Rigid complementarity0≤λn⊥ϕ≥00 \le \lambda_n \perp \phi \ge 0LCP solve per stepExact constraint, hard timesteps
PenaltyFn=kcϕ+bcϕ˙F_n = k_c\phi + b_c\dot\phiCheapΔt≪2/ωc\Delta t \ll 2/\omega_c
Hunt–CrossleyFn=kcϕn(1+32αϕ˙)F_n = k_c\phi^n(1 + \tfrac{3}{2}\alpha\dot\phi)CheapSame as penalty, better energy

Design principle P33.2. Model the contact you cannot measure; measure the contact you cannot model. Use the friction cone and force closure for planning and force budgets; use force or tactile sensing for the residual that the model misses.


Consolidation checkpoint 2

(a) Three capabilities. You can state the Signorini conditions and the Coulomb cone. You can compute the minimum grip force for a misaligned grasp. You can compute penetration depth from force and stiffness and argue why the encoder cannot resolve it.

(b) Transfer probe. The cube’s mass doubles to 0.2 kg and μ\mu drops to 0.4. What grip force is required at rest with the 45∘45^\circ grasp? Answer: F≥2⋅0.981/(2⋅0.4⋅0.7071)=3.47F \ge 2 \cdot 0.981 / (2 \cdot 0.4 \cdot 0.7071) = 3.47 N, within the 5 N standard but with margin only 1.4.

(c) Remediation rule. If you cannot derive Eq. (B.5), re-derive it from the two-contact force balance before Part C.


Part C — Impedance and admittance control

§L.C.1 — Impedance control: shaping the motion–force relation

Impedance control (Hogan 1985, tier A, S) does not regulate position or force; it regulates the relation between them. The target behaviour at the end-effector is

Mdx¨+Bdx˙+Kd(x−xd)=Fext,(C.1)M_d \ddot x + B_d \dot x + K_d (x - x_d) = F_{ext}, \tag{C.1}

where xx is the Cartesian position, xdx_d the reference, and Md,Bd,KdM_d, B_d, K_d the desired inertia, damping, and stiffness. Against a stiff environment, the impedance behaves like a spring of stiffness KdK_d; against a soft environment, it behaves like a mass–damper.

The torque-level implementation solves Eq. (C.1) for the required acceleration and applies inverse dynamics:

x¨cmd=Md−1(Fext−Bdx˙−Kd(x−xd))+x¨d,\ddot x_{cmd} = M_d^{-1}\left(F_{ext} - B_d \dot x - K_d (x - x_d)\right) + \ddot x_d, τ=M(q)J−1(x¨cmd−J˙q˙)+Cq˙+g(q)−J⊤Fext.(C.2)\tau = M(q) J^{-1}\left(\ddot x_{cmd} - \dot J \dot q\right) + C\dot q + g(q) - J^\top F_{ext}. \tag{C.2}

With a force sensor, FextF_{ext} is measured and the law is exact. Without one, the last term is dropped and the rendered impedance is approximate; the robot’s own inertia adds to MdM_d.

A simpler joint-space variant is

τ=Kq(qd−q)−Dqq˙+g(q),(C.3)\tau = K_q(q_d - q) - D_q \dot q + g(q), \tag{C.3}

which renders a Cartesian stiffness Kx≈J−⊤KqJ−1K_x \approx J^{-\top} K_q J^{-1} near the operating configuration. It is the workhorse for contact-rich manipulation because it requires no force sensor and is trivially safe: the force is bounded by KxK_x times the maximum position error.

Self-explanation 1. Why does impedance control render a stiffness rather than a force?

Answer. Because the rendered relation is F=KdΔxF = K_d \Delta x in the static limit; the controller chooses KdK_d and lets the environment determine the force through the displacement.

§L.C.2 — Admittance control and the stiffness-matching rule

Admittance control inverts the causality. It measures the external force and integrates the admittance

Mdx¨d+Bdx˙d+Kd(xd−x0)=Fext(C.4)M_d \ddot x_d + B_d \dot x_d + K_d(x_d - x_0) = F_{ext} \tag{C.4}

to produce a reference motion xdx_d, which a position controller tracks. The robot appears to the environment as an admittance: force in, motion out.

The choice between the two is governed by the stiffness-matching rule. If the environment stiffness kek_e is much larger than the robot’s achievable stiffness KxK_x, use admittance: against a stiff wall, a small position error produces a large force, and the admittance integrates that force into motion, which is stable. If ke≪Kxk_e \ll K_x, use impedance: the environment is compliant, and the robot can render the desired stiffness directly. The rule is a heuristic, not a theorem — the full stability condition is the passivity of the two-port formed by robot and environment — but it holds whenever the stiffnesses dominate the dynamics.

Hybrid position/force control (Raibert & Craig 1981, tier A, S) takes a third route: decompose the task space with a selection matrix SS and control SxS x in position while controlling (I−S)F(I - S) F in force. The decomposition must respect the task’s natural constraints: along a surface, the normal direction is force-controlled and the tangential directions are position-controlled. The selection matrix is a modelling choice, and a wrong choice produces fighting between the two loops.

Force estimation without a sensor. The momentum observer (De Luca & Mattone 2005, tier A, S) computes

r=Ko(p−∫0t(τ−Cq˙−g(q)+r)dτ),(C.5)r = K_o\left(p - \int_0^t \left(\tau - C\dot q - g(q) + r\right) d\tau\right), \tag{C.5}

where p=M(q)q˙p = M(q)\dot q is the generalized momentum. The residual rr converges to J⊤FextJ^\top F_{ext}. It needs only joint torque (measured or inferred from motor current) and the dynamic model, and it is the mechanism by which a sensorless arm can detect contact.

Concept check. A learner implements force control as a position loop whose reference is xd+Ferr/Kpx_d + F_{err}/K_p. Why does this fail against an unknown environment?

Answer. The gain KpK_p is the robot’s stiffness, not the environment’s; the loop regulates position, and the force is whatever the environment produces at that position. Against a stiff environment the effective force gain is enormous and the loop is unstable; against a soft environment it is tiny and the force error persists. The mechanism is that force is not the controlled variable. [displaces M3]

Worked-example ladder.

WE-L.C.a (fully worked). A 2-DOF planar arm has Jacobian J=0.2IJ = 0.2 I at the operating configuration and joint stiffness Kq=100IK_q = 100 I N·m/rad. Compute the Cartesian stiffness and the deflection under a 5 N contact force.

Solution. Kx=J−⊤KqJ−1=100/0.04=2500K_x = J^{-\top} K_q J^{-1} = 100 / 0.04 = 2500 N/m. Deflection Δx=F/Kx=5/2500=2\Delta x = F/K_x = 5/2500 = 2 mm. The contact stiffness kc=105k_c = 10^5 N/m is 40 times larger, so the robot is the compliant element and impedance control is in its stable regime.

WE-L.C.b (completion). Raise KqK_q to 1000I1000 I to reduce the deflection. Compute the new KxK_x, the deflection, and the ratio Kx/kcK_x/k_c. Is the loop still comfortably stable?

Completion. Kx=25,000K_x = 25{,}000 N/m, deflection 0.2 mm, Kx/kc=0.25K_x/k_c = 0.25. The contact natural frequency is (Kx+kc)/m≈1.25×105≈354\sqrt{(K_x + k_c)/m} \approx \sqrt{1.25 \times 10^5} \approx 354 rad/s for m=1m=1; the controller bandwidth is 25,000=158\sqrt{25{,}000} = 158 rad/s, only a factor of 2.2 below. With delay, the margin is thin. The completion shows the trade-off: reducing deflection by raising stiffness moves toward instability.

WE-L.C.c (faded). Analyse the steady state of the admittance (C.4) under a constant force. Faded step: set derivatives to zero: Kd(xd−x0)=FextK_d(x_d - x_0) = F_{ext}, so xd=x0+Fext/Kdx_d = x_0 + F_{ext}/K_d. With Kd=0K_d = 0 the equation is x¨d=Fext/Md\ddot x_d = F_{ext}/M_d and the reference drifts — this is force control, not admittance. The completion shows the design trade-off: Kd→0K_d \to 0 gives force control, Kd→∞K_d \to \infty gives stiff position control, and the useful admittance sits between.

WE-L.C.d (contrastive near-miss). A learner uses impedance control with Kd=5000K_d = 5000 N/m against a steel plate with ke=106k_e = 10^6 N/m and observes 150 Hz chatter. The learner lowers the loop gain of the inner position loop and the chatter persists. Why it fails: the chatter is the contact mode (Kd+ke)/m≈1000\sqrt{(K_d + k_e)/m} \approx 1000 rad/s = 159 Hz, not the position loop. Lowering the position gain does not move it; only reducing KdK_d or switching to admittance does. The fix: with a stiff environment, use admittance control (or reduce KdK_d below 1000 N/m). The near-miss teaches that the relevant stiffness in the stability analysis is the sum of robot and environment stiffness.

Comparative table: impedance, admittance, hybrid force/position.

SchemeControlled variableMeasured variableEnvironment match
ImpedanceMotion-to-force relationPositionSoft environment
AdmittanceForce-to-motion relationForceStiff environment
HybridPosition and force, decoupledPosition and forceTask with known constraint directions

Design principle P33.3. Choose impedance or admittance by comparing the environment stiffness to the robot’s achievable stiffness; choose hybrid control only when the constraint directions are known.


Consolidation checkpoint 3

(a) Three capabilities. You can write the torque-level impedance law and compute KxK_x from KqK_q. You can analyse the admittance steady state. You can apply the stiffness-matching rule.

(b) Transfer probe. A robot with Kx=1000K_x = 1000 N/m must wipe a window whose glass stiffness is 10710^7 N/m. Which scheme, and why? Answer: admittance, because the environment is four orders of magnitude stiffer than the robot; an impedance controller would need to render a stiffness below 1000 N/m to avoid instability, and the force would be uncontrolled.

(c) Remediation rule. If you cannot state why the chatter frequency is (Kd+ke)/m\sqrt{(K_d + k_e)/m}, re-derive the contact mode before Part D.


Part D — Learning contact-rich manipulation

§L.D.1 — Why learn, and what to learn

The contact model of Part B has parameters that are poorly identified: friction coefficient, contact stiffness, damping, and actuator delay each carry 20–50% uncertainty in practice. Model-based impedance control is robust to this uncertainty but cannot adapt the grasp force to the object or the task. Learning can.

The architecture that has proven most reliable is residual reinforcement learning (Johannink et al. 2019, tier B, S): a base controller provides a safe nominal action, and a learned policy outputs a correction,

a=abase+πθ(o),(D.1)a = a_{base} + \pi_\theta(o), \tag{D.1}

where oo is the observation and πθ\pi_\theta is trained by any off-policy algorithm from Module 2.2. The base controller bounds the behaviour; the residual learns the part the model gets wrong. The action space is a design choice with consequences.

Action spaces. Torque actions are expressive but high-dimensional and unsafe; a small torque error produces a large force error against a stiff contact. Cartesian velocity actions are safe but cannot regulate contact force. Impedance-parameter actions — the policy outputs KdK_d and BdB_d, or a target pose for the impedance — are the sweet spot for contact-rich work: they are low-dimensional, bounded, and physically meaningful. For the running case, the natural action is a residual on the impedance setpoint Δx\Delta x, clipped to a safe bound.

Tactile sensing. GelSight (Yuan et al. 2017, tier A, S) measures contact geometry at sub-millimetre resolution; a wrist force/torque sensor measures the aggregate wrench. Both are observations the policy can use. For the running case, the wrist wrench plus the momentum-observer residual of Eq. (C.5) is sufficient.

§L.D.2 — Sim-to-real for contact

The contact sim-to-real gap is dominated by four parameters: friction coefficient, contact stiffness, actuator delay, and object mass. Domain randomization (Tobin et al. 2017, tier A, S) samples these from distributions during training so the policy does not overfit the nominal. Dactyl (OpenAI et al. 2018, tier A, S) demonstrated that large-scale randomization of these parameters, combined with a recurrent policy and distributed training, can produce dexterous in-hand manipulation that transfers to a real hand.

The ranges matter. They should reflect the identification uncertainty, not arbitrary numbers: if system identification (2.1.4 for geometry, Part B here for dynamics) bounds μ\mu to [0.3,0.7][0.3, 0.7], randomize over that interval. Wider randomization makes the policy more conservative and slower; narrower randomization leaves a gap.

Self-explanation 2. Why does residual RL preserve safety better than end-to-end RL?

Answer. Because the base controller bounds the action, and the residual is clipped to a perturbation whose worst-case force KdδmaxK_d \delta_{max} is known; end-to-end RL has no such bound.

Self-explanation 3. Why does the randomization range for friction need to be at least as wide as the identification uncertainty?

Answer. Because a policy trained on a narrower range will exploit the training distribution; if the real friction lies outside, the policy’s grip-force choice is systematically wrong.

Worked-example ladder.

WE-L.D.a (fully worked). The residual policy outputs Δx\Delta x added to the impedance setpoint. With Kd=1000K_d = 1000 N/m and a safe force limit Fsafe=20F_{safe} = 20 N, compute the clipping bound and the force produced if the raw residual is 5 cm.

Solution. δmax=Fsafe/Kd=20/1000=2\delta_{max} = F_{safe}/K_d = 20/1000 = 2 cm. The raw 5 cm is clipped to 2 cm, producing at most 20 N. The clipping bound is the safety mechanism.

WE-L.D.b (completion). Set the domain-randomization ranges for the running case given identification uncertainty: μ=0.5±0.2\mu = 0.5 \pm 0.2, kc=105±0.5×105k_c = 10^5 \pm 0.5 \times 10^5 N/m, delay =10±10= 10 \pm 10 ms, mass =0.1±0.02= 0.1 \pm 0.02 kg. State the ranges and justify each.

Completion. μ∈[0.3,0.7]\mu \in [0.3, 0.7], kc∈[5×104,1.5×105]k_c \in [5 \times 10^4, 1.5 \times 10^5] N/m, delay ∈[0,20]\in [0, 20] ms, mass ∈[0.08,0.12]\in [0.08, 0.12] kg. Each range is the identification interval, not wider; widening beyond it costs performance without buying robustness.

WE-L.D.c (faded). Derive the optimal behaviour under the reward r=−∣xobj−xgoal∣−λFpeak−γ1[slip]r = -|x_{obj} - x_{goal}| - \lambda F_{peak} - \gamma \mathbf{1}[\text{slip}]. Faded step: take the expectation over the randomization distribution and differentiate with respect to the grip-force policy. The completion shows that large λ\lambda yields gentle, slow placement and low slip; small λ\lambda yields fast placement and occasional slip.

WE-L.D.d (contrastive near-miss). A learner trains with nominal μ=0.5\mu = 0.5 and deploys on a slightly damp cube with μ=0.35\mu = 0.35. The cube slips during transport. Why it fails: no randomization; the policy learned a grip force just above the nominal requirement. The fix: randomize μ\mu over the identification range and train with the slip penalty active. The near-miss is the contact sim-to-real gap in miniature.

Comparative table: action spaces for contact-rich learning.

Action spaceExpressivenessSafetySample complexity
Joint torqueHighLowHigh
Cartesian velocityLowHighModerate
Impedance parametersHighHighModerate
Residual on impedanceModerateHighestLowest

Design principle P33.4. Learn the residual, not the whole policy, when a safe controller exists; clip the residual to a force-bounded perturbation.


Consolidation checkpoint 4

(a) Three capabilities. You can write the residual action and its clip. You can set randomization ranges from identification uncertainty. You can state the reward trade-off between speed and force.

(b) Transfer probe. A peg-insertion policy is trained with μ∈[0.2,0.8]\mu \in [0.2, 0.8] and deployed on a peg with μ=0.1\mu = 0.1. What happens? Answer: the policy’s lateral force is calibrated for at least 0.2, so at 0.1 the peg jams; the policy should have been trained with a wider lower bound if μ=0.1\mu = 0.1 is plausible.

(c) Remediation rule. If you cannot justify each randomization range from an identification interval, re-read §L.D.2 before Part E.


Part E — The running case: budgeting, detection, recovery

§L.E.1 — The contact budget of the pick-and-place

The pick-and-place has four contact events: grasp, lift, transport, and release. Each has a force budget.

Grasp. The cube is at Rz(π/4)R_z(\pi/4), so the grasp is misaligned by 45∘45^\circ. From Eq. (B.5), the minimum finger force at rest is 1.39 N; with a 2 m/s² transport acceleration it is 1.67 N. The standard 5 N grip gives a 3× margin. The maximum acceleration before slip at 5 N is

amax=2μFcos⁡θm−g=2⋅0.5⋅5⋅0.70710.1−9.81=25.5 m/s2,(E.1)a_{max} = \frac{2\mu F \cos\theta}{m} - g = \frac{2 \cdot 0.5 \cdot 5 \cdot 0.7071}{0.1} - 9.81 = 25.5\ \text{m/s}^2, \tag{E.1}

about 2.6 g. The nominal transport acceleration should stay below half of that, i.e., 12 m/s², to leave margin for friction variation.

Transport past the divider. The nominal straight path from [0.5,0.2,0.3][0.5, 0.2, 0.3] to [0.4,−0.3,0.15][0.4, -0.3, 0.15] crosses the divider’s yy-range at x≈0.47x \approx 0.47–0.490.49, which is 12–14 cm clear of the divider at x=0.35x = 0.35. The gripper’s outer width is 8 cm, so the gripper’s trailing edge has at least 4 cm clearance. The threat is not the nominal path but swing: if the cube rotates in the grasp, its corner can move several centimetres. The rotation is resisted by the friction moment at the contacts; the maximum rotation before slip is set by the friction cone of the contact patch. For a 5 N grip and a 2.5 cm half-width, the resisting moment is roughly 2μF⋅0.025≈0.1252 \mu F \cdot 0.025 \approx 0.125 N·m, while the inertial moment at 2 m/s² is ma⋅0.025≈0.005m a \cdot 0.025 \approx 0.005 N·m; the margin is large. Swing is therefore not the dominant risk; the dominant risk is the release.

Release. Dropping the cube from z=0.3z = 0.3 to the bin bottom at z=0.15z = 0.15 is a 15 cm fall. Impact velocity is 2g⋅0.15=1.72\sqrt{2g \cdot 0.15} = 1.72 m/s. With a restitution of 0.3, the cube rebounds at 0.52 m/s and rises 1.4 cm — not enough to leave the bin, but enough to be deflected by the rim if the cube has lateral velocity at release. The fix is to descend to 1 cm above the bin bottom with a minimum-jerk profile ending at zero velocity, so the cube is released at rest.

§L.E.2 — Detection, recovery, and fusion with 2.1.5

Detection. The momentum observer of Eq. (C.5) produces a residual rr that converges to J⊤FextJ^\top F_{ext}. A contact is declared when ∣r∣|r| exceeds a threshold for three consecutive control cycles. At 1 kHz, the latency is 3 ms, well below the tens of milliseconds over which slip develops. The threshold is set from the model uncertainty: if the dynamic model is accurate to 2 Nm at the wrist, the threshold is 4 Nm.

Recovery. The state machine from 1.1.4 gains a contact-recovery state: stop the trajectory, back off along the estimated contact normal by 1 cm, re-plan with the 2.3.2 planner, and retry. The health checks of 1.1.4 gain a contact-force check at the control boundary and an object-pose-consistency check at the perception boundary.

Fusion with 2.1.5. During contact, forward kinematics gives the gripper pose TWE(q)T_W^E(q) but not the cube pose: if the cube slips, the gripper and the cube diverge. The eye-in-hand camera tracks the cube with the 2.1.2 6D pose estimator; if the depth channel fails on the cube’s shiny surface, the 2.1.5 visual odometry maintains the camera pose, and the kinematic prior TWC(q)=TWE(q)TECT_W^C(q) = T_W^E(q) T_E^C cross-checks it. The cube pose estimate is therefore maintained through the grasp, and a slip is detected as a divergence between the camera-tracked cube pose and the gripper pose.

Self-explanation 1. Why does the rotated grasp reduce the safety margin even though the friction coefficient is unchanged?

Answer. Because the finger force’s normal component is Fcos⁡θF\cos\theta, so the available friction μFcos⁡θ\mu F\cos\theta is reduced by the cosine of the misalignment.

Self-explanation 2. Why is a 3 ms contact-detection latency acceptable while a 50 ms latency is not?

Answer. Slip velocity under a 1 g tangential overload is about 1 m/s; in 3 ms the cube moves 3 mm, recoverable; in 50 ms it moves 5 cm, past the point of no return.

Worked-example ladder.

WE-L.E.a (fully worked). Compute the maximum transport acceleration at the standard 5 N grip, and the minimum grip force to survive a=2a = 2 m/s².

Solution. From Eq. (E.1), amax=25.5a_{max} = 25.5 m/s². For a=2a = 2: F≥m(g+a)/(2μcos⁡θ)=0.1⋅11.81/0.7071=1.67F \ge m(g+a)/(2\mu\cos\theta) = 0.1 \cdot 11.81/0.7071 = 1.67 N. The standard 5 N has a 3× margin.

WE-L.E.b (completion). The cube is damp and μ\mu drops silently to 0.35. Recompute amaxa_{max} at 5 N and the required force at a=2a = 2 m/s².

Completion. amax=2⋅0.35⋅5⋅0.7071/0.1−9.81=24.75−9.81=14.9a_{max} = 2 \cdot 0.35 \cdot 5 \cdot 0.7071/0.1 - 9.81 = 24.75 - 9.81 = 14.9 m/s² (1.5 g). Required force at a=2a=2: F≥0.1⋅11.81/(2⋅0.35⋅0.7071)=2.39F \ge 0.1 \cdot 11.81/(2 \cdot 0.35 \cdot 0.7071) = 2.39 N. Margin at 5 N is 2.1×. The silent friction drop is invisible until slip; only the momentum-observer residual or a tactile signal reveals it.

WE-L.E.c (faded). Design the release trajectory from z=0.3z = 0.3 to z=0.16z = 0.16 over 0.5 s with a minimum-jerk profile, and compute the impact velocity if the cube is released at z=0.16z = 0.16 with zero velocity. Faded step: minimum jerk gives z(t)=z0+(zf−z0)(10τ3−15τ4+6τ5)z(t) = z_0 + (z_f - z_0)(10\tau^3 - 15\tau^4 + 6\tau^5) with τ=t/T\tau = t/T; the final velocity and acceleration are zero. The completion shows that releasing at z=0.16z = 0.16 with zero velocity produces a 1 cm fall, impact velocity 0.440.44 m/s, and a rebound of 0.13 m/s — safely contained.

WE-L.E.d (contrastive near-miss). A learner releases the cube at z=0.3z = 0.3 while the arm is still moving laterally at 0.2 m/s. The cube bounces off the bin rim and lands on the table. The bounce height (1.4 cm) is not the problem; the lateral velocity is. Why it fails: the cube’s horizontal momentum carries it into the rim, and the rim’s angled contact deflects it out. The fix: release with zero lateral velocity and centred over the bin, and descend to 1 cm above the bottom before opening the fingers.

Comparative table: the four contact events.

EventForce rangeDetection signalRecovery
Grasp1.4–5 N per fingerFinger force or currentRe-close, re-align
LiftUp to m(g+a)m(g+a) tangentialMomentum-observer residualLower, re-grasp
Divider proximityNear zero until contactResidual spikeStop, back off, re-plan
ReleaseImpact up to tens of NResidual spike, accelerometerRecover cube, re-place

Design principle P33.5. Budget the force margin explicitly at every contact event; a grasp that holds at rest may fail under acceleration, and a placement that looks gentle may bounce.


Consolidation checkpoint 5

(a) Three capabilities. You can compute the acceleration budget from the grip force. You can design a release trajectory with zero terminal velocity. You can integrate contact detection and recovery into the 1.1.4 state machine.

(b) Transfer probe. The divider were moved to x=0.45x = 0.45, intersecting the nominal path. What changes in the plan? Answer: the 2.3.2 planner must route around it; the contact budget adds a proximity event; and the swing analysis becomes critical because clearance falls below the gripper width.

(c) Remediation rule. If you cannot compute amaxa_{max} from Eq. (E.1), re-derive the force balance before the lab.


Failure taxonomy

SymptomThree causes rankedDiscriminating testFix
Cube slips during liftFriction lower than modelled; grip force too low; grasp misaligned beyond 45∘45^\circCompare momentum-observer residual to threshold; measure slip with cameraRaise grip force; re-align grasp; randomize μ\mu in training
Chatter at 150–300 Hz on contactContact stiffness higher than modelled; loop gain too high; sampling too slowFFT of force signal; vary KpK_p and observe frequencyLower KpK_p; switch to admittance; raise control rate
Cube bounces out of binRelease velocity nonzero; release height too large; bin rim contactLog release velocity and height; videoDescend to 1 cm; release at rest
Arm drives through the dividerClearance invalidated by swing; planner used stale object poseCheck object pose against gripper poseRe-plan; add proximity check; fuse camera pose
Force sensor reads zero during contactSensor saturated; wiring fault; observer threshold too highCompare encoder-derived stiffness with force readingRecalibrate; lower threshold; use observer
Integral windup during contactIntegrator sees persistent position errorDisable integrator; observe forceAnti-windup; switch to impedance

The table covers the three lab corruptions plus three failures not exercised in the lab: integral windup, sensor saturation, and planner staleness.


The lab

Task. Implement a torque-level impedance controller on the running arm in MuJoCo, execute the pick-and-place with the rotated grasp, detect unintended contact with the momentum observer, and recover. Then train a clipped residual policy on top of the impedance controller in simulation, and evaluate whether it reduces placement error without increasing peak contact force.

Conditions. MuJoCo 3.x with the running arm model, the cube with μ=0.5\mu = 0.5, the divider and bin as specified, 1 kHz control, 2 ms physics timestep, implicit integrator. Python 3.10+, PyTorch 2.x. Seed all RNGs. The eye-in-hand camera is rendered at 30 Hz for object tracking, not for control.

Controls. (i) The 1.1.3 computed-torque position controller as the baseline; (ii) impedance control with fixed Kd=1000K_d = 1000 N/m and 5 N grip; (iii) impedance control with adaptive grip force from the momentum-observer residual; (iv) the residual policy on top of (iii).

Metrics.

MetricDefinitionTarget
Grasp success rateFraction of trials with cube in bin≥ 0.9 for (iii), (iv)
Slip eventsCount of cube displacement > 5 mm in grasp≤ 1 per 20 trials for (iii)
Peak contact forceMaximum normal force at any contact≤ 20 N
Placement errorDistance from cube centre to bin centre≤ 2 cm
Detection latencyTime from contact to flag≤ 5 ms
Transport timeGrasp to release≤ 4 s

Pre-registered hypotheses.

H1. The baseline position controller fails on at least 50% of trials (slip or force spike), while the impedance controller succeeds on at least 80%, because the position controller’s steady-state error under contact produces uncontrolled force.

H2. Adaptive grip force from the observer residual reduces slip events by at least 50% relative to fixed 5 N, because the residual detects friction changes before slip becomes macroscopic.

H3. The clipped residual policy reduces placement error by at least 20% relative to the impedance controller alone, because the residual learns the release timing that the fixed controller cannot.

H4. The residual policy does not increase peak contact force above 20 N, because the clip bounds the action to Kdδmax=20K_d \delta_{max} = 20 N.

Break-it sequence.

  1. Halve the friction silently. Set μ=0.25\mu = 0.25 without telling the controller. The adaptive grip force should raise the force before slip. Silent: the images and the joint trajectories look normal until the cube slips.
  2. Raise the contact stiffness tenfold. Set kc=106k_c = 10^6 N/m. The impedance controller should remain stable; the position controller should chatter. Silent: the force signal looks noisy rather than obviously unstable, and the failure appears as a gradual drift.
  3. Inject a force-sensor bias. Add 2 N constant bias to the measured wrench. The momentum observer, which uses torque rather than the sensor, should still detect contact; the sensor-based detection should produce a false positive. Silent: the bias is constant and looks like a payload.

Acceptance criteria.

CriterionPass condition
Impedance controller stableNo chatter above 50 Hz in the force signal
H1 supportedBaseline failure rate ≥ 50%, impedance success ≥ 80%
H2 supportedSlip reduction ≥ 50%
H3 supportedPlacement error reduction ≥ 20%
H4 supportedPeak force ≤ 20 N in all conditions
Break-it 1 recoveredSlip detected within 5 ms and grip raised
Break-it 2 stableImpedance force variance below threshold
Break-it 3 detectedObserver flags contact despite sensor bias

What good looks like. A good artefact has five properties. (1) The force budget is documented per contact event, with the margin at each. (2) The momentum-observer residual is logged at 1 kHz and plotted against the contact events, so detection latency is measurable. (3) The break-it results are a table, not prose, so the silent corruptions are visible. (4) The residual policy’s action is logged and its clip is verified against the force limit. (5) The object pose from the camera is compared against the gripper pose throughout, so a slip is visible as a divergence, not only as a failure.

A minimal runnable core of the impedance controller and observer, seeded and annotated:

# lab_2_3_3.py — impedance control + momentum observer (MuJoCo)
import numpy as np, mujoco
np.random.seed(0)

model = mujoco.MjModel.from_xml_path("running_arm.xml")   # arm + cube + bin + divider
data  = mujoco.MjData(model)
Kq    = np.diag([80.0]*6)                                 # joint stiffness (Nm/rad)
Dq    = np.diag([4.0]*6)                                  # joint damping
Ko    = np.diag([50.0]*6)                                 # observer gain
r     = np.zeros(6)                                       # residual state

def impedance_torque(q, qd, qdot, $q_des$):
    e = $q_des$ - q                                          # joint error
    return Kq @ e - Dq @ qdot + data.qfrc_bias             # bias = C qdot + g

def momentum_observer(tau, q, qdot, dt):
    global r
    p = data.qM @ qdot                                     # generalized momentum
    r = r + Ko @ (p - (tau + r) * dt)                      # Eq. (C.5), first-order
    return r                                               # converges to J^T $F_ext$

for step in range(4000):                                   # 4 s at 1 kHz
    q, qdot = data.qpos[:6].copy(), data.qvel[:6].copy()
    tau = impedance_torque(q, None, qdot, $q_home$)
    data.ctrl[:] = tau
    mujoco.mj_step(model, data)
    res = momentum_observer(tau, q, qdot, model.opt.timestep)
    if np.linalg.norm(res) > 4.0:                          # contact threshold
        contact_flag = True                                # recovery state entered

Line 7 sets the joint stiffness that renders the Cartesian stiffness of Eq. (C.3); line 8 sets damping; line 9 sets the observer gain, which must be fast enough to track contact but slow enough not to amplify noise. Line 14 uses qfrc_bias, MuJoCo’s precomputed Cq˙+gC\dot q + g. Line 18 is the discrete momentum observer; line 20 is the threshold from the model uncertainty of §L.E.2.


Cheat sheet

Term or resultStatement or definitionRole (origin, consumer)
Contact-modified dynamicsMq¨+Cq˙+g=τ+J⊤FextM\ddot q + C\dot q + g = \tau + J^\top F_{ext}2.3.3; everything below
Steady-state error under contactess=−Kp−1M−1J⊤Fexte_{ss} = -K_p^{-1} M^{-1} J^\top F_{ext}2.3.3; motivates impedance control
Series stiffnessKeff=(1/Kx+1/kc)−1K_{eff} = (1/K_x + 1/k_c)^{-1}2.3.3; force budget
Signorini conditionsϕ≥0\phi \ge 0, λn≥0\lambda_n \ge 0, ϕλn=0\phi\lambda_n = 02.3.3; contact modelling
Coulomb cone$\lambda_t
Linearized coneλt=∑βidi\lambda_t = \sum \beta_i d_i, ∑βi≤μλn\sum \beta_i \le \mu\lambda_n2.3.3; LP formulation
Force closureEvery wrench resisted by cone-admissible forces2.3.1, restated 2.3.3
ε\varepsilon metricRadius of largest wrench-space ball2.3.1, restated 2.3.3
Grasp force (misaligned)F≥m(g+a)/(2μcos⁡θ)F \ge m(g+a)/(2\mu\cos\theta)2.3.3; running case
Max accelerationamax=2μFcos⁡θ/m−ga_{max} = 2\mu F\cos\theta/m - g2.3.3; running case
Penalty contactFn=max⁡(0,kcϕ+bcϕ˙)F_n = \max(0, k_c\phi + b_c\dot\phi)2.3.3; simulation
Impedance relationMdx¨+Bdx˙+KdΔx=FextM_d\ddot x + B_d\dot x + K_d\Delta x = F_{ext}2.3.3; controller
Torque-level impedanceEq. (C.2)2.3.3; implementation
Joint-space impedanceτ=Kq(qd−q)−Dqq˙+g\tau = K_q(q_d - q) - D_q\dot q + g2.3.3; implementation
Cartesian stiffnessKx≈J−⊤KqJ−1K_x \approx J^{-\top} K_q J^{-1}2.3.3; design
AdmittanceMdx¨d+Bdx˙d+Kd(xd−x0)=FextM_d\ddot x_d + B_d\dot x_d + K_d(x_d - x_0) = F_{ext}2.3.3; stiff environments
Stiffness-matching ruleAdmittance for stiff env, impedance for soft2.3.3; selection
Hybrid position/forceSelection matrix SS decomposes the task2.3.3; known constraints
Momentum observerr→J⊤Fextr \to J^\top F_{ext} without a force sensor2.3.3; detection
Residual RLa=abase+πθ(o)a = a_{base} + \pi_\theta(o)2.3.3; learning
Domain randomizationSample μ,kc,m,τd\mu, k_c, m, \tau_d from ID ranges2.3.3; sim-to-real
Q-shieldReject low-value actions at runtime2.2.4, consumed 2.3.3

Exercises with solutions

E 2.3.3.1. Derive Eq. (A.2) from Eq. (A.1) and state the units of each factor.

S 2.3.3.1. At steady state e¨=e˙=0\ddot e = \dot e = 0, so Eq. (A.1) gives Kpe=−M−1J⊤FextK_p e = -M^{-1} J^\top F_{ext}, hence e=−Kp−1M−1J⊤Fexte = -K_p^{-1} M^{-1} J^\top F_{ext}. Units: KpK_p is N·m/rad (or N/m in Cartesian form), M−1M^{-1} is kg−1^{-1}, J⊤J^\top is m (for a rotational joint) or dimensionless, FextF_{ext} is N; the product is metres or radians. The lesson: the error is an equilibrium of two stiffnesses, not a transient.

E 2.3.3.2. A 3-finger grasp has μ=0.4\mu = 0.4 and contact normals at 120∘120^\circ in the plane. Is the grasp force-closed in the plane? Use the friction-cone-of-the-line condition.

S 2.3.3.2. The half-angle is arctan⁡0.4=21.8∘\arctan 0.4 = 21.8^\circ. Each pair of contact normals differs by 120∘120^\circ, so the line joining any two contacts makes an angle of at least 60∘60^\circ with a normal, well outside the cone. The grasp is not force-closed in the plane; it relies on the third finger and on friction. The lesson: three fingers do not guarantee planar force closure; the geometry of the contact normals does.

E 2.3.3.3 (transfer). A robot with Kx=2000K_x = 2000 N/m contacts a surface of stiffness 5×1055 \times 10^5 N/m. It must apply 10 N. Compute the required penetration and the ratio Kx/kcK_x/k_c. Is impedance control stable here?

S 2.3.3.3. Penetration d=F/Keff≈10/2000=5d = F/K_{eff} \approx 10/2000 = 5 mm. Ratio Kx/kc=0.004K_x/k_c = 0.004, so the robot is far more compliant than the environment and impedance control is in its stable regime. The lesson: the stability criterion is the stiffness ratio, not the absolute force.

E 2.3.3.4. State the stiffness-matching rule and explain the mechanism that makes admittance stable against a stiff environment.

S 2.3.3.4. Use admittance when ke≫Kxk_e \gg K_x, impedance when ke≪Kxk_e \ll K_x. Against a stiff environment, the admittance integrates the measured force into a reference motion; the position loop then tracks the reference, and any position error produces a large force that the admittance immediately converts into corrective motion. The loop is a force-to-motion map, which is passive if the admittance is passive. The lesson: the choice is about which variable is the stable input to the loop.

E 2.3.3.5 (diagnostic). A momentum observer on a sensorless arm reports a nonzero residual during free motion. Name two causes and the discriminating test.

S 2.3.3.5. (1) Dynamic-model error, e.g., an unmodelled payload: test by adding the payload mass to the model and checking whether the residual vanishes. (2) Friction in the joints not captured by the model: test by moving at constant velocity in both directions; friction reverses sign with velocity while a payload does not. The lesson: the observer is only as good as the model it subtracts.

E 2.3.3.6. A residual policy is clipped at 2 cm with Kd=1000K_d = 1000 N/m. A safety review asks for the peak force bound. Compute it and state what changes if KdK_d is raised to 4000 N/m.

S 2.3.3.6. Peak force is Kdδmax=1000⋅0.02=20K_d \delta_{max} = 1000 \cdot 0.02 = 20 N. At Kd=4000K_d = 4000, the same clip gives 80 N, exceeding the 40 N gripper limit; the clip must fall to 1 cm to keep the 20 N bound. The lesson: the clip is not a safety guarantee by itself; it is a guarantee only together with the stiffness.

E 2.3.3.7 (transfer). The cube’s mass is unknown within ±20\pm 20%. How does that affect the grip-force budget, and what randomization range would you set?

S 2.3.3.7. The required force scales linearly with mass, so a 20% mass uncertainty requires a 20% increase in the nominal grip force to preserve the same margin, or a randomization range of m∈[0.08,0.12]m \in [0.08, 0.12] kg during training. The lesson: the force budget must include the identification uncertainty, not only the nominal value.

E 2.3.3.8 (diagnostic). The arm chatters against the cube at 300 Hz. The nominal kck_c is 10510^5 N/m and the effective mass is 1 kg. What contact stiffness does the chatter imply, and what does that tell you about the contact?

S 2.3.3.8. ωc=2π⋅300=1885\omega_c = 2\pi \cdot 300 = 1885 rad/s, so kc=mωc2≈3.55×106k_c = m\omega_c^2 \approx 3.55 \times 10^6 N/m. The actual contact is far stiffer than the rubber-pad model; the fingers are touching the cube’s hard plastic corners, not the compliant pads. The lesson: chatter frequency is a contact-stiffness sensor.


Exit test

You are ready for Lesson 2.3.4 when you can, without notes:

  1. Derive the steady-state position error under a constant contact wrench and interpret it.
  2. Compute the series stiffness of robot and contact and explain which dominates.
  3. State the Signorini complementarity and Coulomb friction conditions.
  4. Compute the minimum grip force for a grasp misaligned by θ\theta.
  5. Explain why the linearized friction cone enables a linear program.
  6. Explain why the encoder cannot resolve contact and the force sensor can.
  7. Write the torque-level impedance law and compute KxK_x from KqK_q.
  8. Analyse the admittance steady state and identify the Kd=0K_d = 0 limit as force control.
  9. Apply the stiffness-matching rule and explain its mechanism.
  10. Describe hybrid position/force control and the role of the selection matrix.
  11. Write the momentum observer and state its convergence target.
  12. Design a residual-RL policy with a force-bounded clip.
  13. Set domain-randomization ranges from identification uncertainty.
  14. Budget the grasp force across the pick-and-place and compute amaxa_{max}.
  15. Design a release trajectory with zero terminal velocity and a contact-recovery sequence.

Cross-references. 1.1.3 supplies the computed-torque law restated in §L.A.1. 2.3.1 supplies force closure and the ε\varepsilon metric restated in §L.B.1. 2.3.2 supplies the clearance-margin path invoked in §L.E.1. 2.2.4 supplies the Q-shield consumed in §L.D.2. 2.1.5 supplies the eye-in-hand pose estimator and kinematic prior restated in §L.E.2. Lesson 2.3.4 (in-hand and dexterous manipulation) extends the friction-cone and residual-learning machinery to multi-finger contact. Phase 3’s 3.1.4 extends the residual-learning pipeline to a pre-trained VLA.


Ready. The next lesson to write is 2.3.4 — In-Hand and Dexterous Manipulation. Say “next” to generate it.