Skip to content

Comments

Add per-world actuator fields, dampratio resolution, setLengthRange#1177

Merged
adenzler-nvidia merged 4 commits intogoogle-deepmind:mainfrom
adenzler-nvidia:adenzler/per-world-actuator-fields
Feb 23, 2026
Merged

Add per-world actuator fields, dampratio resolution, setLengthRange#1177
adenzler-nvidia merged 4 commits intogoogle-deepmind:mainfrom
adenzler-nvidia:adenzler/per-world-actuator-fields

Conversation

@adenzler-nvidia
Copy link
Collaborator

Summary

  • Promote actuator_cranklength, actuator_acc0, and actuator_lengthrange from 1D (nu,) to 2D (*, nu) batched arrays, enabling per-world domain randomization
  • Add dampratio resolution to set_const_0: computes dof_M0 and converts positive biasprm[2] (dampratio) to damping coefficient, matching MuJoCo C engine_setconst.c:set0()
  • Add set_length_range() for computing feasible actuator length ranges from joint/tendon limits, implemented as a Warp kernel
  • Fix put_data crash when nefc == 0 with pre-allocated efc_J buffer

Test plan

  • All 78 io_test.py tests pass (72 existing + 6 new)
  • All 51 forward_test.py tests pass
  • All 41 smooth_test.py tests pass
  • New tests: test_set_const_actuator_acc0_per_world, test_set_const_dampratio, test_set_const_dampratio_explicit_kv, test_set_length_range_joint_limited, test_set_length_range_tendon_limited, test_domain_randomize_cranklength
  • Dampratio resolution verified against MuJoCo C with runtime re-resolution (diff < 1e-6)

Promote actuator_cranklength, actuator_acc0, and actuator_lengthrange
from 1D (nu,) to 2D (*, nu) batched arrays, matching the pattern used
by all other expandable actuator fields. This enables per-world domain
randomization of these fields.

Add dampratio resolution to set_const_0: for position actuators where
biasprm[2] > 0 (interpreted as dampratio), compute reflected mass from
dof_M0 and actuator_moment, then convert to damping coefficient via
biasprm[2] = -dampratio * 2 * sqrt(kp * mass). Matches MuJoCo C
engine_setconst.c set0() behavior.

Add set_length_range() for computing feasible actuator length ranges
from joint/tendon limits scaled by gear, implemented as a Warp kernel.

Fix put_data crash when nefc == 0 but efc_J buffer is pre-allocated
(guard reshape with nefc > 0 check).
…actuator-fields

# Conflicts:
#	mujoco_warp/_src/io.py
- Use BiasType.AFFINE enum instead of hardcoded 1
- Replace 1e-12 thresholds with MJ_MINVAL
- Remove redundant damping formula comment
- Move actuator_biasprm to outputs in _resolve_dampratio launch
- Move set_length_range import to top of io_test.py
- Simplify test XML by removing unnecessary body/geom/actuator names
…actuator-fields

# Conflicts:
#	mujoco_warp/_src/io_test.py
@adenzler-nvidia adenzler-nvidia merged commit 98452b5 into google-deepmind:main Feb 23, 2026
10 checks passed
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.

2 participants