feat: add Python checker parity (BodyContact/PositionDelta/OrderedStep) - #6
Open
keyneszeng wants to merge 1 commit into
Open
feat: add Python checker parity (BodyContact/PositionDelta/OrderedStep)#6keyneszeng wants to merge 1 commit into
keyneszeng wants to merge 1 commit into
Conversation
Adds the Python counterparts of the 3 new JS checkers (see companion PRs to AxisWebInfra), wires them into run_checker(), and ships 27 unit tests (7 + 11 + 9) covering overlap/far/missing/same/snake cases, multi-axis OR semantics, ordered multi-step pass/fail, etc. Cross-repo contract: - JS and Python are documented to use the same task-config field names and the same semantic outcome for each checker. - The Python side is the source of truth for offline trajectory validation; the JS side is the source of truth for in-browser teleoperation. Any change to the algorithm must update both. Implementation notes: - BodyContact uses AABB intersection (no live MuJoCo needed offline). - PositionDelta requires an explicit initialPosition (the baseline) because Python is stateless per call; the JS side captures this implicitly via captureRuntimeInitial. - OrderedStep walks a trajectory once with a cursor, since the JS side keeps state across check() calls.
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.
Summary
Adds the Python counterparts of the 3 new JS checkers (companion PRs to
AxisWebInfra), wires them intorun_checker(), and ships 27 unit tests.Changes
util/check_body_contact.py— AABB intersection + inflationutil/check_position_delta.py— per-axis delta vs baselineutil/check_ordered_step.py— walks a trajectory with a step cursortests/test_body_contact.py(7 cases),tests/test_position_delta.py(11 cases),tests/test_ordered_step.py(9 cases)util/validate_offline_trajectory.py— imports the 3 modules and dispatches them inrun_checkerbased ontypeCross-repo contract
JS and Python are documented to use the same task-config field names and the same semantic outcome for each checker. The Python side is the source of truth for offline trajectory validation; the JS side is the source of truth for in-browser teleoperation. Any change to the algorithm must update both.
Implementation notes
BodyContact: AABB intersection (no live MuJoCo needed offline). Considers objects instate.object_positionsand optionalstate.object_extents; default half-extent 2.5 cm.PositionDelta: requires an explicitinitialPosition(orstate["initial_position"]) as the baseline. Without a baseline it conservatively returnsFalse(matching the JS side's first-call behavior wherecaptureRuntimeInitial: truemeans delta = 0 until movement is observed).OrderedStep: walks a trajectory once with a cursor. The caller must pass the full trajectory understate["_trajectory"](a list of state dicts); without it, the check returnsFalserather than guessing.Verification
run_checkerdispatch verified: existing 10 types still work + 3 new types correctly routedRun with::