Skip to content

Commit b880165

Browse files
committed
Pin determinism tests to Isaac Sim PhysX
1 parent 9b4b02b commit b880165

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

source/isaaclab_tasks/test/core/test_environment_determinism.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@
2323

2424
import isaaclab_tasks # noqa: F401
2525
from isaaclab_tasks.utils.hydra import resolve_presets
26-
from isaaclab_tasks.utils.parse_cfg import load_cfg_from_registry, parse_env_cfg
26+
from isaaclab_tasks.utils.parse_cfg import load_cfg_from_registry
27+
28+
# Bit-wise determinism is a physics-backend property, so keep these checks on
29+
# Isaac Sim PhysX rather than following a task's evolving default. Newton
30+
# MJWarp is not yet run-to-run deterministic on CUDA for the locomotion tasks.
31+
_PINNED_PHYSICS_PRESET = "isaacsim_physx"
2732

2833

2934
@pytest.fixture(scope="module", autouse=True)
@@ -100,7 +105,7 @@ def _test_environment_determinism(
100105
device: str,
101106
*,
102107
num_steps: int = 100,
103-
physics_preset_name: str | None = None,
108+
physics_preset_name: str = _PINNED_PHYSICS_PRESET,
104109
deterministic_mode: str | None = None,
105110
):
106111
"""Check deterministic environment creation."""
@@ -138,21 +143,18 @@ def _obtain_transition_tuples(
138143
device: str,
139144
num_steps: int,
140145
*,
141-
physics_preset_name: str | None = None,
146+
physics_preset_name: str,
142147
deterministic_mode: str | None = None,
143148
) -> tuple[dict, torch.Tensor]:
144149
"""Run random actions and obtain transition tuples after fixed number of steps."""
145150
# create a new stage
146151
sim_utils.create_new_stage()
147152
try:
148-
# parse configuration
149-
if physics_preset_name is None:
150-
env_cfg = parse_env_cfg(task_name, device=device, num_envs=num_envs)
151-
else:
152-
env_cfg = load_cfg_from_registry(task_name, "env_cfg_entry_point")
153-
env_cfg = resolve_presets(env_cfg, selected=(physics_preset_name,))
154-
env_cfg.sim.device = device
155-
env_cfg.scene.num_envs = num_envs
153+
# Parse configuration with an explicit physics backend.
154+
env_cfg = load_cfg_from_registry(task_name, "env_cfg_entry_point")
155+
env_cfg = resolve_presets(env_cfg, selected=(physics_preset_name,))
156+
env_cfg.sim.device = device
157+
env_cfg.scene.num_envs = num_envs
156158
if deterministic_mode is not None:
157159
assert isinstance(env_cfg.sim.physics, NewtonCfg)
158160
env_cfg.sim.physics.deterministic_mode = deterministic_mode

0 commit comments

Comments
 (0)