Yield ownership of vector<double>, vector<float>, and vector<int> to mjSpec in Python bindings.

Fixes #2756

PiperOrigin-RevId: 785417251
Change-Id: Ib399c46ee59585258ace7d9583c68b7d06d0a9e4
This commit is contained in:
Alessio Quaglino
2025-07-21 06:43:28 -07:00
committed by Copybara-Service
parent 60f9b34a77
commit fc13995dd4
3 changed files with 13 additions and 6 deletions
+5 -1
View File
@@ -98,9 +98,13 @@ class SpecsTest(absltest.TestCase):
site = body.add_site()
site.name = 'sitename'
site.type = mujoco.mjtGeom.mjGEOM_BOX
site.userdata = [1, 2, 3, 4, 5, 6]
site.userdata = [7, 2, 3, 4, 5, 6]
self.assertEqual(site.name, 'sitename')
self.assertEqual(site.type, mujoco.mjtGeom.mjGEOM_BOX)
np.testing.assert_array_equal(site.userdata, [7, 2, 3, 4, 5, 6])
# Modify a single element of userdata.
site.userdata[0] = 1
np.testing.assert_array_equal(site.userdata, [1, 2, 3, 4, 5, 6])
# Compile the spec and check for expected values in the model.