(self)
| 607 | physics.step() |
| 608 | |
| 609 | def test_plugins_sdf(self): |
| 610 | root = mjcf.RootElement() |
| 611 | root.option.sdf_iterations = 10 |
| 612 | root.option.sdf_initpoints = 40 |
| 613 | |
| 614 | extension = root.extension.add('plugin', plugin='mujoco.sdf.torus') |
| 615 | instance = extension.add('instance', name='torus') |
| 616 | instance.add('config', key='radius1', value='0.35') |
| 617 | instance.add('config', key='radius2', value='0.15') |
| 618 | |
| 619 | # Replicate example in mujoco/model/plugin/elasticity/torus.xml |
| 620 | mesh = root.asset.add('mesh', name='torus') |
| 621 | mesh.add('plugin', instance='torus') |
| 622 | |
| 623 | # Test we can add SDF geom to the worldbody. |
| 624 | worldbody_geom = root.worldbody.add( |
| 625 | 'geom', type='sdf', mesh='torus', rgba=[.2, .2, .8, 1]) |
| 626 | worldbody_geom.add('plugin', instance='torus') |
| 627 | |
| 628 | # Test we can add SDF geom to a body. |
| 629 | body = root.worldbody.add('body', pos=[-1, 0, 3.8]) |
| 630 | body.add('freejoint') |
| 631 | body_geom = body.add('geom', type='sdf', mesh='torus', rgba=[.2, .2, .8, 1]) |
| 632 | body_geom.add('plugin', instance='torus') |
| 633 | |
| 634 | physics = mjcf.Physics.from_mjcf_model(root) |
| 635 | physics.step() |
| 636 | |
| 637 | if __name__ == '__main__': |
| 638 | absltest.main() |
nothing calls this directly
no test coverage detected