From 508669a9f273efaba5b1c9e0662dc99fd28adecd Mon Sep 17 00:00:00 2001 From: Baruch Tabanpour Date: Mon, 29 Jan 2024 11:44:38 -0800 Subject: [PATCH] Raise not implemented for frictionloss for now. #1344 PiperOrigin-RevId: 602453907 Change-Id: I0ea506b54f96c4fadc0f29f9ed0a21b0b6a7e5d9 --- doc/changelog.rst | 1 + mjx/mujoco/mjx/_src/device.py | 3 +++ mjx/mujoco/mjx/_src/io.py | 3 +++ mjx/mujoco/mjx/test_data/shadow_hand/right_hand.xml | 2 +- 4 files changed, 8 insertions(+), 1 deletion(-) 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 @@ - +