Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions motrix_env_motrixsim/tests/test_motrixsim_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,26 @@ def test_dof_position_limits_follow_global_dof_position_order():
np.testing.assert_array_equal(upper[position_slice], limits[:, 1])


def test_finger_zero_depth_contact_steps_without_solver_failure() -> None:
from motrix_env_core import registry

cfg = registry.make_env_config("dm-finger-turn-easy")
model = MotrixSimSceneCompiler().compile(cfg.scene, cfg.sim)
data = mtx.SceneData(model, batch=[1])
# This captured state reaches a zero-depth contact on the second substep.
qpos = np.array([[0.29978949, -0.8047815, 0.09507811, 0.27580708, 0, 0.2943909, 0, 0, 0, 1]], dtype=np.float32)
qvel = np.array([[4.423561, 1.3571916, 1.3083084e-5, 0, 0, 0, 0, 0, 0]], dtype=np.float32)
data.reset(model, qpos, qvel)
data.actuator_ctrls = np.array([[0.9125488, -0.9831114]], dtype=np.float32)
status = np.empty(1, dtype=np.int32)

model.step_n(data, cfg.sim_substeps, result=status)

assert status[0] == 0
assert np.isfinite(data.dof_pos).all()
assert np.isfinite(data.dof_vel).all()


def test_geom_specs_include_only_declared_names_in_order():
from motrix_env_core import registry

Expand Down
3 changes: 2 additions & 1 deletion motrix_envs/src/motrix_envs/basic/finger/finger.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
</option>

<default>
<geom solimp="0 0.9 0.01" solref=".02 1"/>
<!-- Use MuJoCo's positive impedance floor for shallow contacts in MotrixSim. -->
<geom solimp="0.0001 0.9 0.01" solref=".02 1"/>
<joint type="hinge" axis="0 -1 0"/>
<motor ctrllimited="true" ctrlrange="-1 1"/>
<default class="finger">
Expand Down
3 changes: 2 additions & 1 deletion motrix_envs/src/motrix_envs/basic/finger/finger_spin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
</option>

<default>
<geom solimp="0 0.9 0.01" solref=".02 1"/>
<!-- Use MuJoCo's positive impedance floor for shallow contacts in MotrixSim. -->
<geom solimp="0.0001 0.9 0.01" solref=".02 1"/>
<joint type="hinge" axis="0 -1 0"/>
<motor ctrllimited="true" ctrlrange="-1 1"/>
<default class="finger">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
</option>

<default>
<geom solimp="0 0.9 0.01" solref=".02 1"/>
<!-- Use MuJoCo's positive impedance floor for shallow contacts in MotrixSim. -->
<geom solimp="0.0001 0.9 0.01" solref=".02 1"/>
<joint type="hinge" axis="0 -1 0"/>
<motor ctrllimited="true" ctrlrange="-1 1"/>
<default class="finger">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
</option>

<default>
<geom solimp="0 0.9 0.01" solref=".02 1"/>
<!-- Use MuJoCo's positive impedance floor for shallow contacts in MotrixSim. -->
<geom solimp="0.0001 0.9 0.01" solref=".02 1"/>
<joint type="hinge" axis="0 -1 0"/>
<motor ctrllimited="true" ctrlrange="-1 1"/>
<default class="finger">
Expand Down