Skip to main content
These primitives help policy apps avoid raw MuJoCo array plumbing while keeping controllers explicit and composable.

Control Ownership

Use defineControls() with useControls() when a controller, policy, replay, or teleop path writes actuator controls by name. The hook cooperatively claims the declared actuators, uses a generated owner by default, and refuses to write when another writer has already claimed the same actuators.
For sparse updates, use aliases:
For lower-level actuator-name controls, use controlGroup() with useControlGroup():
Use useControlWriter directly only when you need selector-based ownership for sites, bodies, joints, regular expressions, or predicates. For real policy evaluation, make policy, IK, keyboard teleop, replay, and debug state mutation mutually exclusive. Use force: true only for deliberate low-level overrides.

Named Poses

Use pose hooks for HUDs, diagnostics, and verifier logic:
The hooks update refs after physics steps and do not trigger React re-renders.

Contact History

useContactHistory records a bounded contact log with body and geom names:
This is useful for browser verifiers that need evidence of physical contact, not just visual movement.

Named Observations

Named observation builders make policy vector order and units visible:
layout records each field name, vector start, size, and units. Use it in telemetry and tests so model/input mismatches are visible.