Add mjs_attachToSite for attaching a body to a site.
PiperOrigin-RevId: 684432183 Change-Id: I7100bebfb6521f9dbfbb07f31490b2b9298bf18c
This commit is contained in:
committed by
Copybara-Service
parent
694bdebc19
commit
cdb167f275
@@ -857,6 +857,15 @@ class SpecsTest(absltest.TestCase):
|
||||
' attribute',
|
||||
)
|
||||
|
||||
def test_attach_body_to_site(self):
|
||||
child = mujoco.MjSpec()
|
||||
parent = mujoco.MjSpec()
|
||||
site = parent.worldbody.add_site(pos=[1, 2, 3])
|
||||
body = child.worldbody.add_body()
|
||||
self.assertIsNotNone(site.attach(body, '', ''))
|
||||
model = parent.compile()
|
||||
np.testing.assert_array_equal(model.body_pos[1], [1, 2, 3])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
absltest.main()
|
||||
|
||||
Reference in New Issue
Block a user