Make "id" a property rather than a method of mjsElements in Python bindings.
PiperOrigin-RevId: 649424035 Change-Id: I8226b3040aa2001ae9748399257e36ac263b7c8b
This commit is contained in:
committed by
Copybara-Service
parent
f8b944bf7f
commit
118b6810b3
@@ -66,13 +66,15 @@ class SpecsTest(absltest.TestCase):
|
||||
self.assertEqual(site.name, 'sitename')
|
||||
np.testing.assert_array_equal(site.userdata, [1, 2, 3, 4, 5, 6])
|
||||
|
||||
# Check that the site has no id before compilation.
|
||||
self.assertEqual(body.id(), -1)
|
||||
# Check that the site and body have no id before compilation.
|
||||
self.assertEqual(body.id, -1)
|
||||
self.assertEqual(site.id, -1)
|
||||
|
||||
# Compile the spec and check for expected values in the model.
|
||||
model = spec.compile()
|
||||
self.assertEqual(spec.worldbody.id(), 0)
|
||||
self.assertEqual(body.id(), 1)
|
||||
self.assertEqual(spec.worldbody.id, 0)
|
||||
self.assertEqual(body.id, 1)
|
||||
self.assertEqual(site.id, 0)
|
||||
self.assertEqual(model.nbody, 2) # 2 bodies, including the world body
|
||||
np.testing.assert_array_equal(model.body_pos[1], [1, 2, 3])
|
||||
np.testing.assert_array_equal(model.body_quat[1], [0, 1, 0, 0])
|
||||
|
||||
Reference in New Issue
Block a user