Add Jdot correction for connect and weld constaints
Measured reduction in constraint violations before/after this change: | Model | Correction ON (Avg Viol) | Correction OFF (Avg Viol) | Reduction | | :--- | :--- | :--- | :--- | | `jdotv_connect_2d.xml` | 3.959e-4 | 1.699e-3 | **76.7%** | | `jdotv_connect_3d.xml` | 1.399e-3 | 5.493e-3 | **74.5%** | | `jdotv_weld_3d.xml` | 9.472e-3 | 1.148e-2 | **17.5%** | PiperOrigin-RevId: 899137525 Change-Id: Ic3e33764ebd64239bab916289c23d80c3da0b51b
This commit is contained in:
committed by
Copybara-Service
parent
0c337799bd
commit
412cee2059
@@ -60,6 +60,9 @@ class ConstraintTest(parameterized.TestCase):
|
||||
# sample a mix of active/inactive constraints at different timesteps
|
||||
for key in range(3):
|
||||
mujoco.mj_resetDataKeyframe(m, d, key)
|
||||
# scale down velocities to minimize Jdotv effect (not in MJX)
|
||||
# TODO(team): remove this change when mjx supports this feature
|
||||
d.qvel[:] *= 1e-2
|
||||
if rand_eq_active:
|
||||
d.eq_active[:] = np.random.randint(0, 2, size=m.neq)
|
||||
mujoco.mj_forward(m, d)
|
||||
|
||||
@@ -49,6 +49,9 @@ class ForwardTest(absltest.TestCase):
|
||||
d.xfrc_applied[0, 2] = 0.1 # torque
|
||||
d.xfrc_applied[1, 4] = 0.3 # linear force
|
||||
mujoco.mj_step(m, d, 20) # get some dynamics going
|
||||
# scale down velocities to minimize Jdotv effect (not in MJX)
|
||||
# TODO(team): remove this change when mjx supports this feature
|
||||
d.qvel[:] *= 1e-2
|
||||
mujoco.mj_forward(m, d)
|
||||
|
||||
mx = mjx.put_model(m)
|
||||
@@ -92,6 +95,9 @@ class ForwardTest(absltest.TestCase):
|
||||
d.xfrc_applied[0, 2] = 0.1 # torque
|
||||
d.xfrc_applied[1, 4] = 0.3 # linear force
|
||||
mujoco.mj_step(m, d, 20) # get some dynamics going
|
||||
# scale down velocities to minimize Jdotv effect (not in MJX)
|
||||
# TODO(team): remove this change when mjx supports this feature
|
||||
d.qvel[:] *= 1e-2
|
||||
|
||||
dx = jax.jit(mjx.step)(mjx.put_model(m), mjx.put_data(m, d))
|
||||
mujoco.mj_step(m, d)
|
||||
|
||||
Reference in New Issue
Block a user