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 and the fact that it was derived with zero external force. From 2.3.1: force closure and the Ferrari–Canny 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 . 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 with friction coefficient , carry it past the divider at , and release it into the bin at — and every one of those steps is a contact event.
§L.0 — Lesson map, objectives, and misconceptions
| Part | Content | Lab step | Word budget |
|---|---|---|---|
| A | Why contact breaks the position-control pipeline | Measure the steady-state error under contact | 1,600 |
| B | Contact models, the friction cone, grasp force | Compute the grasp force budget | 1,700 |
| C | Impedance and admittance control | Implement a torque-level impedance controller | 1,700 |
| D | Learning contact-rich policies | Train a residual policy in simulation | 1,500 |
| E | Running case: detection, recovery, fusion | Integrate detection and recovery into the pipeline | 1,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 model | Why attractive | Where displaced | Correct model |
|---|---|---|---|
| Contact is a disturbance that high-gain position control rejects. | Disturbance rejection is the standard story for PID. | §L.A.1 | Contact 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.2 | Excess 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.2 | Force 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.1 | Learning 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.2 | A 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 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 . 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 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 . 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:
When the end-effector touches the environment, an external wrench acts at the contact point and enters through the Jacobian transpose:
This is the only change, and it invalidates the 1.1.3 derivation. Substitute the computed-torque law with :
Since ,
The right-hand side is the contact wrench mapped into joint space and scaled by the inverse inertia. At steady state with constant , , so
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 in the simplest case. In series with the contact stiffness , the force produced by a commanded penetration is
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 .
Self-explanation 2. Why does a high-gain position controller against a stiff environment become unstable rather than accurate?
Answer. Raising raises the loop gain and pushes the contact poles toward the contact natural frequency ; once the controller bandwidth approaches , 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 , the velocity jumps to for coefficient of restitution . 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.3controller 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 , , , and a constant contact force N. Compute the steady-state error and the robot’s Cartesian stiffness.
Solution. From Eq. (A.2), m along . The robot must be displaced 5 cm to generate 5 N. Its Cartesian stiffness is N/m. To generate the same 5 N with a stiffer loop, , the displacement would be 0.5 mm — but see the next rung.
WE-L.A.b (completion). With , N/m and the contact stiffness is 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. N/m. The contact natural frequency is rad/s. The controller bandwidth is roughly rad/s, within a factor of 3.3 of ; 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 , controller stiffness , and a pure delay . Faded step: the loop is about the contact equilibrium; linearize the delay as and find the critical . The completion shows that the critical gain falls as , 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 Hz for and … the observed 300 Hz corresponds to a stiffer contact, N/m, consistent with the metal fingers contacting the cube’s hard plastic corners rather than the rubber pads. The fix: lower until the loop bandwidth is at least a factor of five below , 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.
| Mode | Controlled variable | Must measure | Fails when |
|---|---|---|---|
| Position | Joint or Cartesian position | Encoders | Environment stiffness approaches robot stiffness |
| Force | Contact force | Force or torque | Contact is lost |
| Impedance | Dynamic motion-force relation | Position, optionally force | Rendered impedance is non-passive |
| Admittance | Motion response to force | Force | Environment 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 N/m against a spring-loaded fixture of stiffness N/m. What steady-state force does a 2 mm commanded penetration produce? Answer: N/m, so 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 be the gap between the bodies. Then
where 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 satisfies
and during sliding it opposes the slip velocity with maximum magnitude: . Equation (B.2) defines the friction cone: the set of admissible contact forces is a cone with apex at the contact point, half-angle .
Force closure. Restating the result of 2.3.1: stack the contact forces into and form the grasp matrix so that the object wrench is . The grasp is force-closed if for every wrench there exists inside the friction cones with . The 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 with a polygon of edges with directions :
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
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 with . For N/m and kg, 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 N/m, the penetration is m. 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 , so its grasped faces have normals at to the world axes. The gripper closes along world , so the finger force has normal component and tangential component at the contact, with . Compute the minimum finger force to hold the cube at rest, with kg, , and two fingers.
Solution. The available friction at each contact is . Two contacts must carry the weight: . So
The standard 5 N grip force gives a margin of .
WE-L.B.b (completion). Include a transport acceleration m/s² along the direction that adds to gravity. Compute the required finger force and the margin at 5 N.
Completion. Replace with m/s²: N. Margin at 5 N is . The completion shows that the acceleration term costs about 20% of the margin at 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 , , 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 , , the half-angle is , 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 alone (taking ) 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 is larger than 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.
| Model | Force law | Cost | Stability requirement |
|---|---|---|---|
| Rigid complementarity | LCP solve per step | Exact constraint, hard timesteps | |
| Penalty | Cheap | ||
| Hunt–Crossley | Cheap | Same 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 drops to 0.4. What grip force is required at rest with the grasp? Answer: 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
where is the Cartesian position, the reference, and the desired inertia, damping, and stiffness. Against a stiff environment, the impedance behaves like a spring of stiffness ; 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:
With a force sensor, 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 .
A simpler joint-space variant is
which renders a Cartesian stiffness 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 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 in the static limit; the controller chooses 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
to produce a reference motion , 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 is much larger than the robot’s achievable stiffness , 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 , 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 and control in position while controlling 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
where is the generalized momentum. The residual converges to . 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 . Why does this fail against an unknown environment?
Answer. The gain 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 at the operating configuration and joint stiffness N·m/rad. Compute the Cartesian stiffness and the deflection under a 5 N contact force.
Solution. N/m. Deflection mm. The contact stiffness 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 to to reduce the deflection. Compute the new , the deflection, and the ratio . Is the loop still comfortably stable?
Completion. N/m, deflection 0.2 mm, . The contact natural frequency is rad/s for ; the controller bandwidth is 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: , so . With the equation is and the reference drifts — this is force control, not admittance. The completion shows the design trade-off: gives force control, gives stiff position control, and the useful admittance sits between.
WE-L.C.d (contrastive near-miss). A learner uses impedance control with N/m against a steel plate with 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 rad/s = 159 Hz, not the position loop. Lowering the position gain does not move it; only reducing or switching to admittance does. The fix: with a stiff environment, use admittance control (or reduce 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.
| Scheme | Controlled variable | Measured variable | Environment match |
|---|---|---|---|
| Impedance | Motion-to-force relation | Position | Soft environment |
| Admittance | Force-to-motion relation | Force | Stiff environment |
| Hybrid | Position and force, decoupled | Position and force | Task 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 from . You can analyse the admittance steady state. You can apply the stiffness-matching rule.
(b) Transfer probe. A robot with N/m must wipe a window whose glass stiffness is 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 , 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,
where is the observation and 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 and , 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 , 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 to , 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 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 added to the impedance setpoint. With N/m and a safe force limit N, compute the clipping bound and the force produced if the raw residual is 5 cm.
Solution. 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: , N/m, delay ms, mass kg. State the ranges and justify each.
Completion. , N/m, delay ms, mass 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 . Faded step: take the expectation over the randomization distribution and differentiate with respect to the grip-force policy. The completion shows that large yields gentle, slow placement and low slip; small yields fast placement and occasional slip.
WE-L.D.d (contrastive near-miss). A learner trains with nominal and deploys on a slightly damp cube with . The cube slips during transport. Why it fails: no randomization; the policy learned a grip force just above the nominal requirement. The fix: randomize 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 space | Expressiveness | Safety | Sample complexity |
|---|---|---|---|
| Joint torque | High | Low | High |
| Cartesian velocity | Low | High | Moderate |
| Impedance parameters | High | High | Moderate |
| Residual on impedance | Moderate | Highest | Lowest |
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 and deployed on a peg with . 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 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 , so the grasp is misaligned by . 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
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 to crosses the divider’s -range at –, which is 12–14 cm clear of the divider at . 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 N·m, while the inertial moment at 2 m/s² is N·m; the margin is large. Swing is therefore not the dominant risk; the dominant risk is the release.
Release. Dropping the cube from to the bin bottom at is a 15 cm fall. Impact velocity is 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 that converges to . A contact is declared when 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 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 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 , so the available friction 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 m/s².
Solution. From Eq. (E.1), m/s². For : N. The standard 5 N has a 3× margin.
WE-L.E.b (completion). The cube is damp and drops silently to 0.35. Recompute at 5 N and the required force at m/s².
Completion. m/s² (1.5 g). Required force at : 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 to over 0.5 s with a minimum-jerk profile, and compute the impact velocity if the cube is released at with zero velocity. Faded step: minimum jerk gives with ; the final velocity and acceleration are zero. The completion shows that releasing at with zero velocity produces a 1 cm fall, impact velocity 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 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.
| Event | Force range | Detection signal | Recovery |
|---|---|---|---|
| Grasp | 1.4–5 N per finger | Finger force or current | Re-close, re-align |
| Lift | Up to tangential | Momentum-observer residual | Lower, re-grasp |
| Divider proximity | Near zero until contact | Residual spike | Stop, back off, re-plan |
| Release | Impact up to tens of N | Residual spike, accelerometer | Recover 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 , 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 from Eq. (E.1), re-derive the force balance before the lab.
Failure taxonomy
| Symptom | Three causes ranked | Discriminating test | Fix |
|---|---|---|---|
| Cube slips during lift | Friction lower than modelled; grip force too low; grasp misaligned beyond | Compare momentum-observer residual to threshold; measure slip with camera | Raise grip force; re-align grasp; randomize in training |
| Chatter at 150–300 Hz on contact | Contact stiffness higher than modelled; loop gain too high; sampling too slow | FFT of force signal; vary and observe frequency | Lower ; switch to admittance; raise control rate |
| Cube bounces out of bin | Release velocity nonzero; release height too large; bin rim contact | Log release velocity and height; video | Descend to 1 cm; release at rest |
| Arm drives through the divider | Clearance invalidated by swing; planner used stale object pose | Check object pose against gripper pose | Re-plan; add proximity check; fuse camera pose |
| Force sensor reads zero during contact | Sensor saturated; wiring fault; observer threshold too high | Compare encoder-derived stiffness with force reading | Recalibrate; lower threshold; use observer |
| Integral windup during contact | Integrator sees persistent position error | Disable integrator; observe force | Anti-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 , 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 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.
| Metric | Definition | Target |
|---|---|---|
| Grasp success rate | Fraction of trials with cube in bin | ≥ 0.9 for (iii), (iv) |
| Slip events | Count of cube displacement > 5 mm in grasp | ≤ 1 per 20 trials for (iii) |
| Peak contact force | Maximum normal force at any contact | ≤ 20 N |
| Placement error | Distance from cube centre to bin centre | ≤ 2 cm |
| Detection latency | Time from contact to flag | ≤ 5 ms |
| Transport time | Grasp 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 N.
Break-it sequence.
- Halve the friction silently. Set 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.
- Raise the contact stiffness tenfold. Set 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.
- 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.
| Criterion | Pass condition |
|---|---|
| Impedance controller stable | No chatter above 50 Hz in the force signal |
| H1 supported | Baseline failure rate ≥ 50%, impedance success ≥ 80% |
| H2 supported | Slip reduction ≥ 50% |
| H3 supported | Placement error reduction ≥ 20% |
| H4 supported | Peak force ≤ 20 N in all conditions |
| Break-it 1 recovered | Slip detected within 5 ms and grip raised |
| Break-it 2 stable | Impedance force variance below threshold |
| Break-it 3 detected | Observer 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 . Line 18 is the discrete momentum observer; line 20 is the threshold from the model uncertainty of §L.E.2.
Cheat sheet
| Term or result | Statement or definition | Role (origin, consumer) |
|---|---|---|
| Contact-modified dynamics | 2.3.3; everything below | |
| Steady-state error under contact | 2.3.3; motivates impedance control | |
| Series stiffness | 2.3.3; force budget | |
| Signorini conditions | , , | 2.3.3; contact modelling |
| Coulomb cone | $ | \lambda_t |
| Linearized cone | , | 2.3.3; LP formulation |
| Force closure | Every wrench resisted by cone-admissible forces | 2.3.1, restated 2.3.3 |
| metric | Radius of largest wrench-space ball | 2.3.1, restated 2.3.3 |
| Grasp force (misaligned) | 2.3.3; running case | |
| Max acceleration | 2.3.3; running case | |
| Penalty contact | 2.3.3; simulation | |
| Impedance relation | 2.3.3; controller | |
| Torque-level impedance | Eq. (C.2) | 2.3.3; implementation |
| Joint-space impedance | 2.3.3; implementation | |
| Cartesian stiffness | 2.3.3; design | |
| Admittance | 2.3.3; stiff environments | |
| Stiffness-matching rule | Admittance for stiff env, impedance for soft | 2.3.3; selection |
| Hybrid position/force | Selection matrix decomposes the task | 2.3.3; known constraints |
| Momentum observer | without a force sensor | 2.3.3; detection |
| Residual RL | 2.3.3; learning | |
| Domain randomization | Sample from ID ranges | 2.3.3; sim-to-real |
| Q-shield | Reject low-value actions at runtime | 2.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 , so Eq. (A.1) gives , hence . Units: is N·m/rad (or N/m in Cartesian form), is kg, is m (for a rotational joint) or dimensionless, 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 and contact normals at 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 . Each pair of contact normals differs by , so the line joining any two contacts makes an angle of at least 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 N/m contacts a surface of stiffness N/m. It must apply 10 N. Compute the required penetration and the ratio . Is impedance control stable here?
S 2.3.3.3. Penetration mm. Ratio , 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 , impedance when . 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 N/m. A safety review asks for the peak force bound. Compute it and state what changes if is raised to 4000 N/m.
S 2.3.3.6. Peak force is N. At , 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 . 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 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 is 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. rad/s, so 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:
- Derive the steady-state position error under a constant contact wrench and interpret it.
- Compute the series stiffness of robot and contact and explain which dominates.
- State the Signorini complementarity and Coulomb friction conditions.
- Compute the minimum grip force for a grasp misaligned by .
- Explain why the linearized friction cone enables a linear program.
- Explain why the encoder cannot resolve contact and the force sensor can.
- Write the torque-level impedance law and compute from .
- Analyse the admittance steady state and identify the limit as force control.
- Apply the stiffness-matching rule and explain its mechanism.
- Describe hybrid position/force control and the role of the selection matrix.
- Write the momentum observer and state its convergence target.
- Design a residual-RL policy with a force-bounded clip.
- Set domain-randomization ranges from identification uncertainty.
- Budget the grasp force across the pick-and-place and compute .
- 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 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.