Check MJX with JAX backend for flex.
PiperOrigin-RevId: 782964265 Change-Id: I744d114569738ad0d5c4ee11ffba90bd50ef25ed
This commit is contained in:
committed by
Copybara-Service
parent
6e7aaacb85
commit
2a700c98aa
@@ -293,6 +293,8 @@ The following features are **unsupported**:
|
|||||||
- ``PGS``
|
- ``PGS``
|
||||||
* - :ref:`Sensors <mjtSensor>`
|
* - :ref:`Sensors <mjtSensor>`
|
||||||
- ``PLUGIN``, ``USER``
|
- ``PLUGIN``, ``USER``
|
||||||
|
* - Flex
|
||||||
|
- All
|
||||||
|
|
||||||
.. _MjxSharpBits:
|
.. _MjxSharpBits:
|
||||||
|
|
||||||
|
|||||||
@@ -227,6 +227,9 @@ def _put_model_jax(
|
|||||||
device: Optional[jax.Device] = None,
|
device: Optional[jax.Device] = None,
|
||||||
) -> types.Model:
|
) -> types.Model:
|
||||||
"""Puts mujoco.MjModel onto a device, resulting in mjx.Model."""
|
"""Puts mujoco.MjModel onto a device, resulting in mjx.Model."""
|
||||||
|
if m.nflex:
|
||||||
|
raise NotImplementedError('Flex not implemented for JAX backend.')
|
||||||
|
|
||||||
mesh_geomid = set()
|
mesh_geomid = set()
|
||||||
for g1, g2, ip in collision_driver.geom_pairs(m):
|
for g1, g2, ip in collision_driver.geom_pairs(m):
|
||||||
t1, t2 = m.geom_type[[g1, g2]]
|
t1, t2 = m.geom_type[[g1, g2]]
|
||||||
|
|||||||
@@ -967,6 +967,19 @@ class ResolveImplAndDeviceTest(parameterized.TestCase):
|
|||||||
self.assertEqual(impl, Impl.C)
|
self.assertEqual(impl, Impl.C)
|
||||||
self.assertEqual(device.platform, 'cpu')
|
self.assertEqual(device.platform, 'cpu')
|
||||||
|
|
||||||
|
def test_flex_jax(self):
|
||||||
|
with self.assertRaises(NotImplementedError):
|
||||||
|
m = mujoco.MjModel.from_xml_string("""
|
||||||
|
<mujoco>
|
||||||
|
<worldbody>
|
||||||
|
<flexcomp name="flex" type="grid" dim="1" count="3 1 1" mass="1" spacing=".1 .1 .1">
|
||||||
|
<pin id="0"/>
|
||||||
|
</flexcomp>
|
||||||
|
</worldbody>
|
||||||
|
</mujoco>
|
||||||
|
""")
|
||||||
|
mjx.put_model(m, impl='jax')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
absltest.main()
|
absltest.main()
|
||||||
|
|||||||
Reference in New Issue
Block a user