Skip to content

feat(checker): add BodyContactChecker matching Hub usage - #7

Open
keyneszeng wants to merge 1 commit into
AxisAIOrg:mainfrom
keyneszeng:feat/body-contact-checker
Open

feat(checker): add BodyContactChecker matching Hub usage#7
keyneszeng wants to merge 1 commit into
AxisAIOrg:mainfrom
keyneszeng:feat/body-contact-checker

Conversation

@keyneszeng

Copy link
Copy Markdown

Summary

Adds a new success-condition checker that detects when two MuJoCo bodies are in (or near) contact. This matches the BodyContactChecker type already used in production Hub task JSON (e.g. task 4694, whose checker_config is published via the public Hub API).

Why

The Hub backend, AxisDataCleaning (Python), and this AxisWebInfra (JS) MUST agree on what counts as a successful task attempt. Until now, the JS side was missing 3 checkers that Hub already uses in production.

This PR is part 1 of 3 to restore JS / Python / Hub parity.

Changes

  • New file src/components/mujoco-framework-next/checkers/BodyContactChecker.js (~270 lines incl. docstring)
  • Modified src/components/mujoco-framework-next/checkers/index.js — registered the new class and added the body_contact alias

Task config schema (matches Hub)

{
  "type": "BodyContactChecker",
  "body_a": "akita_black_bowl_1_main",
  "body_b": "plate_1_main",
  "max_contact_distance": 0.02,    // meters; default 0
  "min_contact_count": 1            // default 1
}

Cross-repo coordination

  • JS (this PR): walks MuJoCo's data.contact array and counts pairs (geom1, geom2) where one geom belongs to body_a and the other to body_b, with dist <= max_contact_distance.
  • Python (companion PR to AxisDataCleaning): same semantics, but using AABB intersection + inflation (offline validation, no live MuJoCo).
  • Hub backend: already present, uses the same field names.

Verification

  • JS: manually instantiated through a real CheckerManager with mock data — constructor succeeds, check() returns the expected boolean, getStatus() produces the expected progress object.
  • Python: 7/7 unit tests pass.

JS testing in real mujoco-js requires Node + mujoco-js (I don't have it locally); happy to add a vitest harness if maintainers want.

Checklist

  • Follows existing checker pattern
  • Options support both snake_case and camelCase (Hub uses both)
  • getStatus() / getProgress() / reset() / updateModelData() implemented
  • Companion Python PR follows the same algorithm

Adds a new success-condition checker that detects when two MuJoCo
bodies are in (or near) contact. This matches the BodyContactChecker
type already used in production Hub task JSON (e.g. task 4694).

Mirrors the Python implementation added in the companion PR to
AxisDataCleaning, so JS and Python checks agree on the success
condition for offline trajectory validation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant