Enable procedural plugin activation in Python bindings.
PiperOrigin-RevId: 746055614 Change-Id: Idcc2f62fdfeccdca356e3d1acadf168b46a98881
This commit is contained in:
committed by
Copybara-Service
parent
b1f8d444f2
commit
a209134315
@@ -835,22 +835,19 @@ class SpecsTest(absltest.TestCase):
|
||||
self.assertEqual(model.nsensor, 9)
|
||||
|
||||
def test_plugin(self):
|
||||
xml = """
|
||||
<mujoco>
|
||||
<extension>
|
||||
<plugin plugin="mujoco.elasticity.cable"/>
|
||||
</extension>
|
||||
</mujoco>
|
||||
"""
|
||||
|
||||
spec = mujoco.MjSpec.from_string(xml)
|
||||
self.assertIsNotNone(spec.worldbody)
|
||||
spec = mujoco.MjSpec()
|
||||
spec.activate_plugin('mujoco.elasticity.cable')
|
||||
plugin = spec.add_plugin(
|
||||
name='instance_name',
|
||||
plugin_name='mujoco.elasticity.cable',
|
||||
active=True,
|
||||
info='info',
|
||||
)
|
||||
|
||||
body = spec.worldbody.add_body()
|
||||
body.plugin = plugin
|
||||
body.plugin.plugin_name = 'mujoco.elasticity.cable'
|
||||
body.plugin.id = spec.add_plugin()
|
||||
body.plugin.active = True
|
||||
self.assertEqual(body.plugin.id, 0)
|
||||
|
||||
geom = body.add_geom()
|
||||
geom.type = mujoco.mjtGeom.mjGEOM_BOX
|
||||
|
||||
Reference in New Issue
Block a user