Skip to content

ADR-0029 — Contact is MuJoCo's collision (the simulator's, else on the recorded pose); the footprint circle is a proximity alert

Status: Accepted by the operator on 2026-12-02 ("accept adr029 and evolve as new findings come in"): a living decision, revised in place as findings come in, each revision dated below. Earlier the same day: "We should definitely be able to know if real contact or our proximity alarm", "lets also adjust terminology to use proximity alert and contact". Revisions: 2026-12-02 proposed (contact by the re-pose check); 2026-12-02 the simulator's touches first, obstacles by the scene's names, no verdict on a duck host without either (the advisor's review, the operator's go); 2026-12-02 accepted; 2026-12-02 the host kind says which source a host has, and contact.step_s records its time resolution (RFC-0028 step 3); 2026-12-02 the truth log and the evaluator run from the sampler's t=0 to the verdict, and no later; every truth row carries t, the sampler's clock, and the checker's times are on it; the first touch is recorded beside the deepest; the alert has its own distance, footprint.alert_m (the evaluator's review). Date: 2026-12-02 Context documents: ADR-0015 ("No contact list": truth is the trunk pose), docs/wip/LEARNING-ARC-FINDINGS.md (smaller margins; the real-touch check), libs/runner/CONTRACT.md 1.9 (conditions.clearance_m)

Context

The evaluator (labrunner.evaluator) fails a run with contact when the trunk's centre comes within footprint.radius_m (0.083 m) of a box's outline. That is a circle round the trunk, not the body: the duck reaches 0.075 m forward and 0.071 m to the side standing (Pollen's collision meshes). ADR-0015 took the circle because the body server exposes no contact list.

The circle and the body disagree, both ways, in the records:

  • Of 17 evaluator contacts across the margin labs (2026-12-01 and 02), the duck's convex outline at the truth pose overlapped the box in 9 (1 to 7 mm), came within 1 mm in 3, and stayed 4 to 10 mm clear in 5 (real_touch.py, the outline at two keyframes).
  • The operator's goal: "minimise margins to avoid actual contacts and to put proximity alarms in good places we can use them to plan and validate navigation and controls". A margin sweep needs to know whether the body touched, and a near pass is information, not a failure.

What exists now (commit 5fe7a08): the truth records the body server's 15 joint positions per sample; a challenge run keeps the world it simulated (scene.xml); robots/duck/sim/contacts.py poses Pollen's model at every sample and runs MuJoCo's collision (make test-contacts). It runs in Pollen's venv: MuJoCo is in no repo venv.

Decision

  1. Contact is a duck collision geom penetrating an obstacle (a box the scene lists in boxes, by its name; floors and slabs are not obstacles). It fails the run. Its source, best first (revised 2026-12-02, after the advisor's review):
  2. the simulator's touches: our patch to Pollen's body server (robots/duck/sim/patches/body-server-touches.patch, applied by scripts/host-setup, checked by scripts/host-check) records every 5 ms physics step's penetrations; the truth sampler polls them with each sample (op touches) and the run keeps them in truth.jsonl, which holds every sample from the sampler's t=0 to the verdict (the sampler stops before the checker runs, so the checker reads the whole log and nothing is logged after the verdict). contact.by: "simulator". A run with no floor touch at all (floor_samples 0: the duck always stands on something) has a dead op and no verdict. Each row carries t, seconds on the sampler's clock, which is the clock of proximity.t, contact.first_t and the checker's times (repose first_t, gap_m and pairs t); a log from before rows had t is timed from its first row, which was logged about 0.25 s late.
  3. MuJoCo's collision on the recorded pose, after the run: the robot's checker (contacts.py --obstacles <the scene's box names>, the host's MuJoCo python) on truth.jsonl and scene.xml. contact.by: "mujoco". With source 1 it still runs, for gap_m per obstacle and the (trunk, body) distance pairs a proximity alert is placed from, and its own contacts are recorded as contact.repose, deciding nothing.

The result records contact: {by, step_s, checked, contact_samples, first_t, first_part, first_obstacle, first_depth_m, deepest_m, deepest_t, obstacle, part}: the first touch is first_* (its time, part, obstacle, depth) and the deepest is deepest_m, deepest_t, obstacle and part, which are two touches when the first was shallow (ch3-s2: jaw_soft 0.9 mm at 42.686 s, then ankle_left 1.8 mm at 44.391 s); the verdict text names both. step_s is the source's time resolution in seconds, which the host kind names (simhost.contacts): 0.005 for the simulator's touches (the body server's physics step), the truth sample period (0.05) for a check of recorded poses and for the footprint circle. A touch shorter than step_s can be missed, so a run evaluated by a coarser source says so. A run with no source (by: "none") has none to say. 2. Proximity alert is a ring round the trunk: the trunk's centre within footprint.alert_m of an outline, else within footprint.radius_m when the profile gives no alert_m. It is recorded (proximity: its first time, the obstacle, the distance; alert_m beside it: the distance the run used) and fails nothing. The duck's radius_m 0.083 m is its standing reach and stays the circle that is the contact where nothing better evaluates it (contact_by "circle") and the navigator's reflex corridor; its alert_m is 0.13 m, the walking reach 0.1175 m (robots/duck/sim/contacts.py) plus 0.012 m, one 50 ms sample's peak travel. It no longer takes the evaluator's one broken slot, so it cannot hide a fall or a drop after it. min_clearance_m and nearest stay as they were. 3. No check, no verdict. A run whose contact check could not run (no joints recorded, no scene.xml, the checker failed) has pass: null and no_verdict: "contact_unchecked: <why>", as rtf_low does. So does a duck host with neither source (contact.by: "none"): the same run is never evaluated by the body on one host and by the circle on another. A host with no Pollen checkout (the NXT, whose body is the circle) evaluates contact by the circle as before, and its result says contact.by: "circle". 4. Old results stay comparable: a circle contact is min_clearance_m < footprint.radius_m, which every result already has. A tally reports both columns.

Consequences

Positive. A margin can be lowered until the body touches, and the run says which part touched which box and how deep. The proximity alert stays where it was, so a lab can count near passes and contacts separately, and move the alert (a profile threshold) without changing what fails.

Negative. We carry a patch to Pollen's code (the body server), re-applied on every host and on every pin bump. Without it, the checker (source 2) misses a touch shorter than one truth period (50 ms at 20 Hz) and sits the backlash hinges (±1°) at 0; source 1 has neither limit. A duck host with neither source gives no verdicts. The checker adds about 10 s to a run (1,000 to 1,600 samples).

Neutral. Pass rates from before this change counted circle contacts as failures; a comparison across the change recomputes one side from min_clearance_m.

Alternatives considered

  • The re-pose check alone (this ADR as first proposed): no patch to Pollen's code, but it misses a touch between samples and the backlash. The advisor's review (2026-12-02) put the patch first; the operator gave the go the same day.
  • A larger circle or the outline at two keyframes (real_touch.py): cheaper, but still a guess at the legs and head; the recorded joints make the guess unnecessary.
  • A live check that stops the goal on contact. The circle never stopped a run (STOPS is fall and bounds), so a post-run check changes no run's course. The touches op makes a live stop possible; not done.