fix(validation/G4): emit simulator-resolved spawn z in Scenic so pose_tolerance compares apples-to-apples (Option A)#23
Merged
Conversation
…_tolerance compares apples-to-apples (Option A) The G4 family-C pose_tolerance invariant compared the Scenic-sampled object pose against the post-reset MuJoCo pose, but the renderer emitted every object at a bare TABLE_Z placeholder z while the simulator resolved the real settled z. Every movable failed on an 8-18 cm z-frame mismatch (0/97 pose_tolerance True). See rca/stage1_g4_consistency_pose_frame_mismatch.md (Option A). Fix (Option A): a single shared pure helper resolves the spawn z; the renderer calls it at codegen to emit a CONCRETE z, and the simulator delegates to it, so both sides agree and the simulator's z-override becomes a no-op. - asset_metadata.surface_spawn_z(surface_z, asset_class): the one source of truth. surface_z + per-class spawn clearance. - Per-class clearance is the settled body-origin height above TABLE_Z, MEASURED from the authoritative LIBERO MuJoCo assets (not bbox h/2 -- the body origin is not the geometric centre and objects settle onto collision geometry). Stored in data/spawn_clearances.json; regenerate via scripts/measure_spawn_clearances.py. No hardcoded per-class constants. - simulator._surface_spawn_z now delegates to the shared helper; _infer_root_surface_z inverts the same clearance so the round trip is consistent (inferred surface ~= TABLE_Z). - renderer emits surface_spawn_z(TABLE_SURFACE_Z, class) as a concrete float for absolutely-placed LIBEROObjects (relative/contained placements unchanged). Tests: tests/test_spawn_z_consistency.py asserts renderer-side and simulator _surface_spawn_z agree <=1mm for every measured class/surface, the renderer emits the concrete z (no TABLE_Z placeholder), and the TABLE_Z constant does not drift across asset_metadata/simulator/scenic model. Smoke (kitchen, through G6): pose_tolerance 0/97 -> 11/12 True on a 3-condition quick run (full run in PR body). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…d diagnostics The spawn-clearance fallback for classes absent from the measured registry (object-axis OOD variants, distractor-pool objects) previously used bbox height/2 — the exact model the z-frame RCA refuted, which under-places objects ~5-9 cm and re-introduces the pose_tolerance mismatch for every unmeasured class. Replace it with DEFAULT_CLEARANCE = the median measured clearance (~0.10 m), a data-derived prior in the correct table band. Measured classes are unchanged. Also adds scripts/measure_spawn_clearances coverage notes and the smoke_categorized / diagnose_pose_failures diagnostics used to quantify pose_tolerance by failure category (non-substituted vs object-axis variant vs contained). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Isolates the z-frame fix's domain (excludes robot/distractor axes, which physically displace objects post-settle — the separate settle-drift issue documented as Finding B in the run2 RCA). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Owner
Author
Categorized smoke results (shipped code)Per-axis z verification (real envs): non-displacing subset SMOKE_TASKS × non-displacing subsets (6 subsets × 5 tasks = 30 conditions, 108 movables): SMOKE_TASKS × random subsets (8, incl. robot/distractor; 40 conditions, 163 movables): Failure decomposition (per-axis Δ, bowl task):
Net: the z-frame defect is resolved; residual |
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.
Problem
G4 family-C
pose_tolerancecompares the Scenic-sampled object pose against the post-reset MuJoCo pose, requiring agreement within 5 mm (validation plan §4). But the renderer emitted every object at a bareTABLE_Zplaceholder z (renderer/scenic_renderer.py:401"Use TABLE_Z as placeholder — simulator overrides with actual z") while the simulator resolved the real settled z. The two sides lived in different z-frames, so every movable failed on an 8–18 cm z mismatch → 0/97pose_toleranceTrue, even thoughclass_matchand xy were correct.This is the 4th, independent defect surfaced after PR #22, root-caused in
~/.omar/ea/4/validation_run2/rca/stage1_g4_consistency_pose_frame_mismatch.md(Option A recommended).Fix (Option A): one shared helper resolves spawn z; renderer emits it concretely
src/libero_infinity/asset_metadata.py— single source of truth:surface_spawn_z(TABLE_SURFACE_Z, class)) for absolutely-placedLIBEROObjects — no symbolic call, noTABLE_Zplaceholder. Relative/contained placements (offset by … 0.0) are unchanged (their z derives from the support relation, not the table surface)._surface_spawn_znow delegates to the same helper, and_infer_root_surface_zinverts the same clearance, so the round trip is consistent (inferred surface ≈TABLE_Z). The simulator's z-override becomes a no-op for agreeing objects.Half-height plumbing (no hardcoded constants)
The old
_surface_spawn_zusedbbox_height / 2, which is wrong: the MuJoCo body origin is not the geometric centre, and objects settle onto collision geometry the bounding box doesn't capture (empiricallysurface + h/2was 18–90 mm off the settled z). Analytical lowest-collision-point reconstruction was also unreliable (~20 mm error on scanned objects due to canonical-orientation effects).So the per-class spawn clearance — the settled body-origin height above
TABLE_Z— is measured from the authoritative LIBERO MuJoCo assets byscripts/measure_spawn_clearances.py(deterministic seed, median over many table-resting instances, kitchen-table frame) and stored indata/spawn_clearances.json(a generated registry, like the existingOBJECT_DIMENSIONS). Re-run the generator after asset upgrades. Classes absent from the registry fall back to the legacy bbox approximation so the helper stays total (e.g. unmeasured OOD object-axis variants).15 classes measured, covering all SMOKE_TASKS movables (bowl, plate, wine_bottle, cream_cheese, frypan, moka_pot, mugs, butter, milk, ketchup, …).
Tests
tests/test_spawn_z_consistency.py:_surface_spawn_z≤ 1 mm for every measured class × surface (the core invariant; guards future divergence).LIBEROObjectkeeps theTABLE_Zplaceholder.TABLE_SURFACE_Zdoes not drift acrossasset_metadata/simulator.TABLE_Z/libero_model.scenic.PYTHONPATH=src .venv/bin/python -m pytest tests/ -k 'invariant or consistency or g4' -q→ 156 passed. Settle/G5 suites (test_settle_correctness,test_g5_settle_drift_fixtures,test_simulator_param_consumers) → 48 passed (no regression from the simulator-side changes).Smoke (non-scenic-only, through G6) — pose_tolerance
Per-class after: akita_black_bowl 3T/0F, cream_cheese 3T/0F, plate 2T/1F, wine_bottle 3T/0F. The single False is post-settle xy drift on the plate — the secondary, asset-specific physics noise the RCA flagged as separate (not the z-frame defect this PR fixes). A full ≥20-condition run across {bowl, plate, bottle, cabinet+contained} × multiple subsets is in progress; numbers will be posted as a comment.
Scope / out of scope
TABLE_Z, so those remain a known, separate limitation (the contained/elevated minority the RCA acknowledged). No tolerance widening, notry/exceptmasking, no band-aids.🤖 Generated with Claude Code