|
23 | 23 |
|
24 | 24 | import isaaclab_tasks # noqa: F401 |
25 | 25 | from isaaclab_tasks.utils.hydra import resolve_presets |
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" |
| 26 | +from isaaclab_tasks.utils.parse_cfg import load_cfg_from_registry, parse_env_cfg |
32 | 27 |
|
33 | 28 |
|
34 | 29 | @pytest.fixture(scope="module", autouse=True) |
@@ -63,7 +58,7 @@ def test_manipulation_env_determinism(task_name, device): |
63 | 58 | @pytest.mark.parametrize("device", ["cuda", "cpu"]) |
64 | 59 | def test_locomotion_env_determinism(task_name, device): |
65 | 60 | """Check deterministic environment creation for locomotion.""" |
66 | | - _test_environment_determinism(task_name, device) |
| 61 | + _test_environment_determinism(task_name, device, physics_preset_name="physx") |
67 | 62 |
|
68 | 63 |
|
69 | 64 | @pytest.mark.parametrize( |
@@ -105,7 +100,7 @@ def _test_environment_determinism( |
105 | 100 | device: str, |
106 | 101 | *, |
107 | 102 | num_steps: int = 100, |
108 | | - physics_preset_name: str = _PINNED_PHYSICS_PRESET, |
| 103 | + physics_preset_name: str | None = None, |
109 | 104 | deterministic_mode: str | None = None, |
110 | 105 | ): |
111 | 106 | """Check deterministic environment creation.""" |
@@ -143,18 +138,21 @@ def _obtain_transition_tuples( |
143 | 138 | device: str, |
144 | 139 | num_steps: int, |
145 | 140 | *, |
146 | | - physics_preset_name: str, |
| 141 | + physics_preset_name: str | None = None, |
147 | 142 | deterministic_mode: str | None = None, |
148 | 143 | ) -> tuple[dict, torch.Tensor]: |
149 | 144 | """Run random actions and obtain transition tuples after fixed number of steps.""" |
150 | 145 | # create a new stage |
151 | 146 | sim_utils.create_new_stage() |
152 | 147 | try: |
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 |
| 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 |
158 | 156 | if deterministic_mode is not None: |
159 | 157 | assert isinstance(env_cfg.sim.physics, NewtonCfg) |
160 | 158 | env_cfg.sim.physics.deterministic_mode = deterministic_mode |
|
0 commit comments