Odom anchor sets - #278
Merged
Merged
Conversation
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
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
Coverage71.59% lines on this branch, against a floor of 70%. Per-file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Odometry: anchor points sampled on the alpha sole mesh, 16-point grid by default
The contact odometry picks its ground anchor from a set of candidate points on each sole, expressed in the foot-site frame. Since the port those were four hardcoded corners: the v1.5 sole bbox, ±27.0 × ±20.6 mm on the site's Z = 0 plane, flagged as a placeholder and never measured.
The alpha sole does not look like that. In the site frame it spans X [-20, +34] mm (54 mm long, 7 mm forward of the site), Y ±21 mm, and its bottom is canted 4.9° about X. The old corners float 2 mm above the real contact on one side and sit inside the sole on the other, and the robot stands 2 to 4 mm taller than it is.
What changes
odometry/src/anchors.rsis generated bymicroduck_rl/scripts/odom_anchor_points.py(PR pollen-robotics/microduck_rl#), which shoots a vertical ray through each sample point and keeps the lowest triangle of the sole collision mesh. Each foot is sampled on its own mesh. Three sets:V15: the legacy corners, unchanged.ALPHA4: the four corners of the flat contact patch, on the mesh.ALPHA16: a 4×4 grid over the whole footprint, bevels included, on the mesh.Odometry::newtakes an&'static AnchorSet;alpha_with(&SET)picks one;Odometry::alpha()now runsALPHA16. robotd needs no change.Why 16 points
Measured in the MuJoCo twin with
infer_policy --odom-compare(perfect IMU, so only the contact geometry differs), 3.2 m of keyboard-driven walking over 23.8 s:The sole is rounded, so when the foot pitches the contact rolls onto the bevel; four corners on the flat patch cannot follow that, the grid can.
Cost
cargo test -p odometry --release -- --ignored --nocapture update_cost_per_anchor_set, x86 laptop:On the Zero 3's A55 expect a few µs per 20 ms tick. Negligible.
Checks
fmt, test, clippy,
cargo board -p robotdall pass. Not yet validated on the robot: the sim used rigid feet, and the PU sole's compliance may shift the numbers.🤖 Generated with Claude Code