diff --git a/doc/changelog.rst b/doc/changelog.rst index 16ffb157..efb9aff6 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -31,6 +31,7 @@ MJX 8. Added ``mjx.ray`` which mirrors :ref:`mj_ray` for planes, spheres, capsules, boxes, and meshes. 9. Added ``mjx.is_sparse`` which mirrors :ref:`mj_isSparse` and ``mjx.full_m`` which mirrors :ref:`mj_fullM`. 10. Added support for specifying sparse or dense mass matrices via :ref:`option-jacobian`. +11. Raise a not implemented error when nonzero frictionloss is present. Fixes :github:issue:`1344`. Python bindings ^^^^^^^^^^^^^^^ diff --git a/mjx/mujoco/mjx/_src/device.py b/mjx/mujoco/mjx/_src/device.py index 2819d9ea..79aafa1a 100644 --- a/mjx/mujoco/mjx/_src/device.py +++ b/mjx/mujoco/mjx/_src/device.py @@ -164,6 +164,9 @@ def _validate(m: mujoco.MjModel): if f & m.opt.enableflags: warnings.warn(f'Ignoring enable flag {f.name}.') + if not np.allclose(m.dof_frictionloss, 0): + raise NotImplementedError('dof_frictionloss is not implemented.') + @overload def device_put(value: mujoco.MjData) -> types.Data: diff --git a/mjx/mujoco/mjx/_src/io.py b/mjx/mujoco/mjx/_src/io.py index 095c4eae..91478ffd 100644 --- a/mjx/mujoco/mjx/_src/io.py +++ b/mjx/mujoco/mjx/_src/io.py @@ -109,6 +109,9 @@ def put_model(m: mujoco.MjModel, device=None) -> types.Model: f'{[mj_type(m) for m in missing]} not supported' ) + if not np.allclose(m.dof_frictionloss, 0): + raise NotImplementedError('dof_frictionloss is not implemented.') + opt = _put_option(m.opt, device=device) stat = _put_statistic(m.stat, device=device) diff --git a/mjx/mujoco/mjx/test_data/shadow_hand/right_hand.xml b/mjx/mujoco/mjx/test_data/shadow_hand/right_hand.xml index 2ec862e5..b0795c28 100644 --- a/mjx/mujoco/mjx/test_data/shadow_hand/right_hand.xml +++ b/mjx/mujoco/mjx/test_data/shadow_hand/right_hand.xml @@ -12,7 +12,7 @@ - +