Add plugins list to mjSpec Python API.
Fixes #2061. PiperOrigin-RevId: 677762985 Change-Id: I8e407373e7b505d9b0f1c023e97c5ea92169bbf6
This commit is contained in:
committed by
Copybara-Service
parent
91cedfd65c
commit
0ba11b9623
@@ -690,5 +690,32 @@ class SpecsTest(absltest.TestCase):
|
||||
):
|
||||
spec.recompile(model, data)
|
||||
|
||||
def test_delete_unused_plugin(self):
|
||||
spec = mujoco.MjSpec()
|
||||
spec.from_string(textwrap.dedent("""
|
||||
<mujoco model="MuJoCo Model">
|
||||
<extension>
|
||||
<plugin plugin="mujoco.pid">
|
||||
<instance name="pid1">
|
||||
<config key="kp" value="4.0"/>
|
||||
</instance>
|
||||
</plugin>
|
||||
</extension>
|
||||
|
||||
<worldbody>
|
||||
<body>
|
||||
<geom size="1"/>
|
||||
</body>
|
||||
</worldbody>
|
||||
</mujoco>
|
||||
"""))
|
||||
plugin = spec.plugins[0]
|
||||
self.assertIsNotNone(plugin)
|
||||
plugin.delete()
|
||||
|
||||
model = spec.compile()
|
||||
self.assertIsNotNone(model)
|
||||
self.assertEqual(model.nplugin, 0)
|
||||
|
||||
if __name__ == '__main__':
|
||||
absltest.main()
|
||||
|
||||
Reference in New Issue
Block a user