Commit Graph
3 Commits
Author SHA1 Message Date
apirroneandClaude Fable 5.1 dd0f8c2212 odometry: ALPHA16 is the default anchor set
Measured in the MuJoCo twin (infer_policy --odom-compare, perfect IMU,
3.2 m of keyboard-driven walking, 23.8 s):

  set      final xy err  max xy err  final z err
  v15         17.3 mm      24.5 mm     +3.7 mm
  alpha4      15.6 mm      21.6 mm     +0.9 mm
  alpha16      9.1 mm      19.7 mm     +0.5 mm

Odometry::alpha() now runs the 16-point grid. V15 and ALPHA4 stay as
named sets for alpha_with() and the cost/reference tests.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014ZPSQ6nCsfqannMDXwAKZ3
2026-09-13 14:53:40 +02:00
apirroneandClaude Fable 5.1 09fd7e992b odometry: anchor sets sampled on the alpha sole mesh
The contact odometry picked its anchor from four hardcoded corners: the
v1.5 sole bbox, ±27.0 x ±20.6 mm on the foot-site Z = 0 plane, a placeholder
since the port. The alpha sole is 54 mm long, sits 7 mm forward of the
site, and its bottom is canted 4.9° about X in the site frame, so those
corners float 2 mm above the real contact on the low side and 3 mm under
the mesh on the high side.

`anchors.rs` is GENERATED by microduck_rl/scripts/odom_anchor_points.py,
which drops a grid of vertical rays onto the sole collision mesh:

  V15      the legacy corners (unchanged behaviour)
  ALPHA4   the flat contact patch's four corners, on the mesh
  ALPHA16  a 4x4 grid over the whole footprint, bevels included

`Odometry` takes an `&'static AnchorSet`; `Odometry::alpha()` still uses
V15, so robotd is unchanged until the sets have been compared (infer_policy
--odom-compare in microduck_rl). `alpha_with(&ALPHA16)` is the switch.

Cost, `update_cost_per_anchor_set` on an x86 laptop: 484 ns per update
with 4 points per foot, 951 ns with 16. On the Zero 3's A55 expect a
handful of µs — nothing next to a 20 ms tick.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014ZPSQ6nCsfqannMDXwAKZ3
2026-09-13 14:19:54 +02:00
apirroneandClaude Fable 5 cc972c533f Kinematics & odometry: the robot learns where it is, from its own MJCF
Two new subcrates, absorbed from the prototype side:

- `kinematics`: FK parsed from the same robot_walk.xml the policies train
  against — update the MJCF and it still works. Compiled for the control
  loop: per-site flattened chains, indexed joints, zero allocation per
  query (~7-10x the prototype crate's site_pose). Hand-rolled quat/pose
  math pinned to MuJoCo's mj_kinematics at 1e-6 by fixture, cv2/sensor
  conventions and alpha sign pins carried over from the runtime shim.

- `odometry`: the Rhoban-derived contact estimator (sole-corner anchor,
  IMU re-projection), with the foot chains taken from the kinematics
  model instead of hand-transcribed segment tables, and each foot's
  chain evaluated once per tick instead of once per corner.

robotd ticks the estimator at the loop's own 50 Hz on the sample it
already read — no extra bus traffic, which is exactly the pressure the
spasms investigation taught this loop not to add — and publishes the
estimate as `odom` on robot.state (serde-default, no API bump). The
monitor shows x/y/yaw on its own header row.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 12:47:44 +02:00