RFC-0035: The duck's odometry reads long because of its joints' play; correct it where it starts¶
Status: Proposed (2026-12-04). The operator, the same day: A2 first ("yes, try A2 first"; section 6, question 1) Date: 2026-12-04 Asked by the operator, 2026-12-04: "Are we solving the root cause here or symptoms", then "Trace it", "Lets run both checks and I am leaning toward A", and "make an RFC just for this problem since very crucial". Builds on: RFC-0034 (a robot's measured errors in its profile, one set in the simulator and one on the real robot), ADR-0027 (simulator first), ADR-0030 (scenes from the error budget). Evidence: at b82075e; Pollen's microduck at 094d4bb4 and microduck_rl at 0daab160 (the pins). The work log is STABILIZE-AB.md, "Why the map had no path" and "Where the map's metres go wrong". What is not verified is in section 7.
1. The problem¶
16 of the 45 "no path on the map" refusals that can be replayed from their records (section 3) have the true room open: doors 0.27 to 0.45 m wide, where the duck needs 0.24 m. In all 16 the map's wall cells and the depth memory together close the way; either alone leaves it open. They put the same faces a few centimetres apart, and the planner keeps both.
The first answer offered was a second scale on mapd's grid, ×1.04 on top of the 0.911 already applied. The operator asked whether that would solve the cause or a symptom. A symptom: the 4 % is what is left of a correction made in the wrong place. This RFC traces the cause and proposes the fix there.
2. The chain, from the cause to the refusal¶
- The joints have play. In the simulator's walking scene each servo is followed by a passive
backlash hinge of ±1° (microduck_rl
add_backlash.py; the walking policy needs it to walk). Under load the play sits near its limit: within 10 % of it in 62 to 66 % of the leg joints' samples while walking. - robotd's odometry does not see the play. Its contact odometry (microduck
odometrycrate) takes the leg's shape from the joint angles the body server reports, which are the servo's side, as a real servo's encoder would be. The legs are taken to reach further than they do, and the stride is counted long: 10 to 15 % long, more at low speed. - mapd keeps the odometry's scale. mapd's keyframes are linked by that odometry, and scan matching does not correct the scale. At every stop the navigator's belief is the raw odometry ×0.910 (504 runs), so mapd's pose is the odometry's.
- We correct afterwards, with one number.
calibration/sim.jsonodom_scale0.911 (measured 2026-11-14, straight walks at 0.3 m/s) shrinks the odometry, mapd's pose and mapd's grid alike. The navigator walks mostly at 0.2 m/s, where the over-read is larger, so the belief still reads about 3 % long. mapd's grid comes out about 4 % short. A likely reason, not measured: the grid places true-metre depth readings at odometry-metre poses, and the one scale shrinks both. - The grid and the memory disagree. The navigator's depth memory is true-metre readings from
the believed pose. A face 1.4 m from the start lands up to about 11 cm from where the grid has
it. Where they differ by more than half a cell,
CostGrid.from_map_gridkeeps both, and a door closes.
3. Evidence¶
| Step | What was measured | Result | Script |
|---|---|---|---|
| 5 | The 45 refusals re-planned with the navigator's own CostGrid and plan() |
16 refuse again; for the other 29 the record holds no map from the moment of the refusal (the last is 0.1 to 8 s older) | scripts/stabilize/nopath_replan.py |
| 5 | The same 16, the grid stretched ×1.02, ×1.04, ×1.06 | 9, 13, 16 find a way | same |
| 5 | Memory points with a wall cell under them, 589 runs | 0.25 as the navigator had it; 0.37, 0.40, 0.41 stretched ×1.02, ×1.04, ×1.06 | scripts/stabilize/map_agree.py |
| 4 | The grid's walls against the real boxes, 375 runs | best fit ×1.04 (quartiles 1.025, 1.055); mean wall-to-face distance 3.2 cm, 1.6 cm at the fit | scripts/stabilize/map_scale.py |
| 3 | Odometry, belief and truth, 504 runs | truth / odometry 0.881 (quartiles 0.875, 0.888); belief / odometry at stops 0.910 | scripts/stabilize/odom_vs_mapd.py |
| 1, 2 | Four straight walks, robotd's own odometry code replayed on the logged angles | the table below | robots/duck/sim/probes/odom_play_slip.py, odom_play_slip_report.py, odom_replay/ |
Truth over each, per walk:
| vx m/s | robotd live | replay, servo angles | replay, servo + play | mapd's pose |
|---|---|---|---|---|
| 0.2 | 0.845, 0.853 | 0.845, 0.853 | 0.985, 0.986 | 0.845, 0.861 |
| 0.3 | 0.906, 0.902 | 0.906, 0.902 | 1.003, 1.000 | 0.922, 0.902 |
The servo replay equals robotd's live odometry, so the replay is robotd's code. With the play, the
error drops from 10 to 15 % to 1.5 % or less, which bounds foot slip and everything else. The body
server's probe op that reads the play is our patch, v3 (robots/duck/sim/patches/body-server-touches.patch;
scripts/host-setup applies it).
4. Options¶
| Option | Where | What it fixes | Against it |
|---|---|---|---|
| A1. A per-robot odometry scale in robotd, by speed, before mapd | robotd (Pollen's) | mapd builds in true metres, the grid and the memory agree, 0.911 goes | still a fitted number, by speed (0.849 to 0.930); the simulator's and the real duck's differ |
| A2. The play in robotd's odometry: a loaded joint's link taken at its play limit, on the side the load pushes it | robotd (Pollen's) | the same, from the robot's measured play rather than a speed table | needs a signal robotd has that says which way each joint is loaded; untested |
| B. The simulator reports the link's angle | the body server | the simulator's odometry | hides from the simulator what a real servo would show: rejected |
| C. Our side only: stretch the grid (×1.04), or put the memory into mapd's metres | the navigator | the planner's consistency | a second correction on the first; the map's metres stay wrong; a symptom |
D. The narrow fix's 0.10 m ring (--nav-fix narrow) |
the navigator | opens all 16 | cuts the safety margin; a symptom |
| E. Log the grid each plan used, at a refusal | the navigator | every refusal can be replayed (29 of 45 cannot now) | none; independent of the rest |
5. Proposal¶
A2, tested before robotd is touched, with A1 as the fallback, and E in any case.
- The best A2 can do, offline. Replay the logged walks with each link at its play limit on the side it really sat. If that is not within about 2 % of the truth, A2 is not worth building: go to A1.
- Whether robotd can tell the side. Add the servo targets to the probe and check whether the servo's position error (target minus measured) predicts which side the play sits on. This needs one probe walk with the simulator, on the operator's word.
- The patch. A2 (or A1) as our patch to robotd, applied by
scripts/host-setuplike the body server's, with a test that replays the logged walks through it. The play per joint comes from the profile (RFC-0034): the simulator's from the MJCF, the real duck's measured. - Remove the after-the-fact scale.
odom_scaleandodom_by_speedgo fromcalibration/sim.json, and the navigator stops scaling mapd's pose and grid. - Check it.
odom_vs_mapd.py,map_scale.pyandmap_agree.pyon new runs: truth / odometry near 1, the grid's best fit near ×1.00, memory on the walls well above 0.25. Then an A/B on challenges 24 and 28 against the current navigator, on the operator's word. - E, as its own change in the navigator.
- Upstream. The issue for Pollen (UPSTREAM-ODOMETRY-DRAFT.md) rewritten from these measurements, posted only on the operator's word.
6. Questions for the operator¶
- A2 first, with A1 as the fallback, or A1 now? Answered 2026-12-04: A2 first.
- The fix lives as our patch to robotd (as the body server's does), offered to Pollen, or only upstream?
- Step 2's probe walk and step 5's A/B: simulator time, each on your word.
7. Not verified¶
- The grid being short because true-metre depth is placed at odometry-metre poses (section 2, step 4). Consistent with the numbers; not measured.
- Foot slip on its own. It is bounded (1.5 % or less), not measured: a contact point moves as the foot rolls, so its travel is not slip.
- Turns. The four walks are straight; the yaw is the IMU's, but turning steps were not replayed.
- The real duck. Its play is not measured; ±1° is the simulator model's figure.
- That fixing the odometry ends the 16 refusals. It is expected from section 3 (the stretched grid opens them); it is shown only by step 5.
- The other 29 refusals: their maps are not in the records (E).
8. A2 tried, 2026-12-04: not buildable from what robotd has, in the simulator¶
Steps 1 and 2 of section 5, on the first probe walks (odom-play-slip) and a second set with the
servos' targets and signed forces (patch v4, odom-play-side). robotd's own odometry code replayed
on each model of the link's angle; truth over each, the four walks (0.2, 0.2, 0.3, 0.3 m/s) of the
second set:
| The link's angle taken as | Truth / replay | Script |
|---|---|---|
| the servo's (robotd today) | 0.854, 0.852, 0.918, 0.908 | odom_play_slip.py |
| the servo's + the play, exact | 0.986, 0.988, 1.004, 0.998 | same |
| at its limit on the true side | 0.990, 0.982, 1.011, 1.001 | odom_play_model.py |
| a fixed offset per joint (the play's mean) | 0.854, 0.850, 0.919, 0.908 | odom_play_offset.py |
| at the limit the servo's position error says, per joint | 0.851, 0.861, 0.928, 0.921 | odom_play_side.py |
| at the limit the servo's signed force says, per joint | 0.852, 0.866, 0.930, 0.924 | same |
| at the limit the leg's phase (stance, swing) says, per joint | 0.823, 0.830, 0.887, 0.882 | odom_play_stance.py |
- Step 1 passes. With the true side, and the link between when less than half the play is used
(
three50on the first set: 0.992, 0.995, 1.006, 1.008), the model reads within 1 %. So knowing the side would be enough. - Step 2 fails. No signal robotd has predicts the side: the position error and the force agree with the play's state in 54 % of the leg-joint samples (fitted per joint on 0.2 m/s, tested on 0.3 m/s); the leg's phase in 68 to 70 %. Each moves the replay by 1 % at most, or makes it worse. The play sits mostly on one side of each joint, mirrored left and right, but where it sits on average does not change the stride: the over-read comes from its switching sides within a step, and none of these signals times the switches.
- Not covered. The simulator's force is its MJCF position actuators', not the servo model the
walking policy was trained on (microduck
docs/design/simulation.md), and itsreaddrops the current's sign; a real servo's signed current may carry the side. A model of the leg's dynamics (the load from the gait, not a sign) was not tried.
By section 5, step 1's rule, A2 goes no further: A1 is next, a per-robot odometry scale by speed in robotd, before mapd. Question 2 of section 6 (our patch to robotd, or only upstream) is open.