Add support for indexing qfrc fields in MJX bind() method.
PiperOrigin-RevId: 763415415 Change-Id: Idb567a1711679565444779fb1062d7b65434ef13
This commit is contained in:
committed by
Copybara-Service
parent
22bdf22cc7
commit
4a102c37bc
@@ -249,6 +249,11 @@ class SupportTest(parameterized.TestCase):
|
||||
dx.bind(mx, s.joints[i]).qacc,
|
||||
d.qacc[m.jnt_dofadr[i]:m.jnt_dofadr[i] + dofnum[i]], decimal=6
|
||||
)
|
||||
np.testing.assert_array_almost_equal(
|
||||
dx.bind(mx, s.joints[i]).qfrc_actuator,
|
||||
d.qfrc_actuator[m.jnt_dofadr[i] : m.jnt_dofadr[i] + dofnum[i]],
|
||||
decimal=6,
|
||||
)
|
||||
|
||||
np.testing.assert_array_equal(dx.bind(mx, s.actuators).ctrl, d.ctrl)
|
||||
for i in range(m.nu):
|
||||
@@ -344,7 +349,7 @@ class SupportTest(parameterized.TestCase):
|
||||
):
|
||||
print(dx.bind(mx, s.actuators).set('actuator_ctrl', [1, 2, 3]))
|
||||
with self.assertRaisesRegex(
|
||||
AttributeError, 'qpos, qvel, qacc are not available for this type'
|
||||
AttributeError, 'qpos, qvel, qacc, qfrc are not available for this type'
|
||||
):
|
||||
print(dx.bind(mx, s.geoms).qpos)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user