diff --git a/doc/changelog.rst b/doc/changelog.rst index ccad2ea6..4d787323 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -2,6 +2,14 @@ Changelog ========= + +Upcoming version (not yet released) +----------------------------------- + +Bug fixes +^^^^^^^^^ +1. Fixed :github:issue:`2212`, type error in ```mjx.get_data``. + Version 3.2.5 (Nov 4, 2024) --------------------------- diff --git a/mjx/mujoco/mjx/_src/io.py b/mjx/mujoco/mjx/_src/io.py index 28b84bbe..200d742e 100644 --- a/mjx/mujoco/mjx/_src/io.py +++ b/mjx/mujoco/mjx/_src/io.py @@ -432,9 +432,9 @@ def get_data_into( # MuJoCo actuator_moment is sparse, MJX uses a dense representation. if field.name == 'actuator_moment' and m.nu: - moment_rownnz = np.zeros(m.nu, dtype=int) - moment_rowadr = np.zeros(m.nu, dtype=int) - moment_colind = np.zeros(m.nu * m.nv, dtype=int) + moment_rownnz = np.zeros(m.nu, dtype=np.int32) + moment_rowadr = np.zeros(m.nu, dtype=np.int32) + moment_colind = np.zeros(m.nu * m.nv, dtype=np.int32) actuator_moment = np.zeros(m.nu * m.nv) mujoco.mju_dense2sparse( actuator_moment, diff --git a/mjx/mujoco/mjx/_src/io_test.py b/mjx/mujoco/mjx/_src/io_test.py index d5905b86..cbb10ebe 100644 --- a/mjx/mujoco/mjx/_src/io_test.py +++ b/mjx/mujoco/mjx/_src/io_test.py @@ -422,6 +422,26 @@ class DataIOTest(parameterized.TestCase): np.testing.assert_allclose(d_2.efc_aref, d.efc_aref) np.testing.assert_allclose(d_2.contact.efc_address, d.contact.efc_address) + def test_get_data_runs(self): + xml = """ + + + + + + + + + + + + + """ + m = mujoco.MjModel.from_xml_string(xml) + d = mujoco.MjData(m) + dx = mjx.put_data(m, d) + mjx.get_data(m, dx) + def test_get_data_batched(self): """Test that get_data makes correct List[MjData] for batched Data."""