MCPcopy Create free account
hub / github.com/google-deepmind/dm_control / test_plugins_sdf

Method test_plugins_sdf

dm_control/mjcf/physics_test.py:609–635  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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
637if __name__ == '__main__':
638 absltest.main()

Callers

nothing calls this directly

Calls 3

from_mjcf_modelMethod · 0.80
addMethod · 0.45
stepMethod · 0.45

Tested by

no test coverage detected