Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Fixed
^^^^^

* Fixed ineffective joint actuation in direct-workflow PhysX environments by filtering collisions between
replicas on all simulation devices.
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ def _setup_scene(self):
pos = cloner.grid_transforms(self.scene.num_envs, self.scene.cfg.env_spacing, device=self.device)[0]
plan = cloner.clone_plan_from_env_0(src, dest, self.scene.num_envs, self.device, pos)
cloner.replicate(plan, stage=self.scene.stage)
# we need to explicitly filter collisions for CPU simulation
if self.device == "cpu":
# PhysX replication requires explicit collision filtering between environments.
if "physx" in self.scene.physics_backend:
self.scene.filter_collisions(global_prim_paths=[self.cfg.terrain.prim_path])
# add lights
light_cfg = sim_utils.DomeLightCfg(intensity=2000.0, color=(0.75, 0.75, 0.75))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ def _setup_scene(self):
plan = cloner.clone_plan_from_env_0(src, dest, self.scene.num_envs, self.device, pos)
cloner.replicate(plan, stage=self.scene.stage)

if self.device == "cpu":
# we need to explicitly filter collisions for CPU simulation
# PhysX replication requires explicit collision filtering between environments.
if "physx" in self.scene.physics_backend:
self.scene.filter_collisions()

self.scene.articulations["robot"] = self._robot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def _setup_scene(self):
pos = cloner.grid_transforms(self.scene.num_envs, self.scene.cfg.env_spacing, device=self.device)[0]
plan = cloner.clone_plan_from_env_0(src, dest, self.scene.num_envs, self.device, pos)
cloner.replicate(plan, stage=self.scene.stage)
# we need to explicitly filter collisions for CPU simulation
if self.device == "cpu":
# PhysX replication requires explicit collision filtering between environments.
if "physx" in self.scene.physics_backend:
self.scene.filter_collisions(global_prim_paths=["/World/ground"])

# add articulation to scene
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ def _setup_scene(self):
plan = cloner.clone_plan_from_env_0(src, dest, self.scene.num_envs, self.device, pos)
cloner.replicate(plan, stage=self.scene.stage)

# we need to explicitly filter collisions for CPU simulation
if self.device == "cpu":
# PhysX replication requires explicit collision filtering between environments.
if "physx" in self.scene.physics_backend:
self.scene.filter_collisions(global_prim_paths=[self.cfg.terrain.prim_path])

# add lights
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def _setup_scene(self):
plan = cloner.clone_plan_from_env_0(src, dest, self.scene.num_envs, self.device, pos)
cloner.replicate(plan, stage=self.scene.stage)

if self.device == "cpu":
# we need to explicitly filter collisions for CPU simulation
# PhysX replication requires explicit collision filtering between environments.
if "physx" in self.scene.physics_backend:
self.scene.filter_collisions(global_prim_paths=[])

# add articulation and sensors to scene
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def _setup_scene(self):
pos = cloner.grid_transforms(self.scene.num_envs, self.scene.cfg.env_spacing, device=self.device)[0]
plan = cloner.clone_plan_from_env_0(src, dest, self.scene.num_envs, self.device, pos)
cloner.replicate(plan, stage=self.scene.stage)
# we need to explicitly filter collisions for CPU simulation
if self.device == "cpu":
# PhysX replication requires explicit collision filtering between environments.
if "physx" in self.scene.physics_backend:
self.scene.filter_collisions(global_prim_paths=[])

# add articulation to scene
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ def _setup_scene(self):
pos = cloner.grid_transforms(self.scene.num_envs, self.scene.cfg.env_spacing, device=self.device)[0]
plan = cloner.clone_plan_from_env_0(src, dest, self.scene.num_envs, self.device, pos)
cloner.replicate(plan, stage=self.scene.stage)
# PhysX replication requires explicit collision filtering between environments.
if "physx" in self.scene.physics_backend:
self.scene.filter_collisions(global_prim_paths=["/World/ground"])
# add articulation to scene - we must register to scene to randomize with EventManager
self.scene.articulations["right_robot"] = self.right_hand
self.scene.articulations["left_robot"] = self.left_hand
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ def _setup_scene(self):
pos = cloner.grid_transforms(self.scene.num_envs, self.scene.cfg.env_spacing, device=self.device)[0]
plan = cloner.clone_plan_from_env_0(src, dest, self.scene.num_envs, self.device, pos)
cloner.replicate(plan, stage=self.scene.stage)
# we need to explicitly filter collisions for CPU simulation
if self.device == "cpu":
# PhysX replication requires explicit collision filtering between environments.
if "physx" in self.scene.physics_backend:
self.scene.filter_collisions(global_prim_paths=[self.cfg.terrain.prim_path])
# add articulation to scene
self.scene.articulations["robot"] = self.robot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def _setup_scene(self):
pos = cloner.grid_transforms(self.scene.num_envs, self.scene.cfg.env_spacing, device=self.device)[0]
plan = cloner.clone_plan_from_env_0(src, dest, self.scene.num_envs, self.device, pos)
cloner.replicate(plan, stage=self.scene.stage)
# we need to explicitly filter collisions for CPU simulation
if self.device == "cpu":
# PhysX replication requires explicit collision filtering between environments.
if "physx" in self.scene.physics_backend:
self.scene.filter_collisions(global_prim_paths=[])
# add articulation to scene
self.scene.articulations["robot"] = self.robot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ def _setup_scene(self):
pos = cloner.grid_transforms(self.scene.num_envs, self.scene.cfg.env_spacing, device=self.device)[0]
plan = cloner.clone_plan_from_env_0(src, dest, self.scene.num_envs, self.device, pos)
cloner.replicate(plan, stage=self.scene.stage)
# PhysX replication requires explicit collision filtering between environments.
if "physx" in self.scene.physics_backend:
self.scene.filter_collisions(global_prim_paths=[])
# add articulation to scene - we must register to scene to randomize with EventManager
self.scene.articulations["robot"] = self.hand
self.scene.rigid_objects["object"] = self.object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ def _setup_scene(self):
pos = cloner.grid_transforms(self.scene.num_envs, self.scene.cfg.env_spacing, device=self.device)[0]
plan = cloner.clone_plan_from_env_0(src, dest, self.scene.num_envs, self.device, pos)
cloner.replicate(plan, stage=self.scene.stage)
# PhysX replication requires explicit collision filtering between environments.
if "physx" in self.scene.physics_backend:
self.scene.filter_collisions(global_prim_paths=["/World/ground"])
# add articulation to scene - we must register to scene to randomize with EventManager
self.scene.articulations["robot"] = self.hand
self.scene.rigid_objects["object"] = self.object
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this test necessary? I think there are other tests (test_environments) that already provide this coverage

# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause

"""Test PhysX actuation in the direct-workflow Cartpole environment."""

from isaaclab.app import AppLauncher

# launch the simulator
simulation_app = AppLauncher(headless=True).app

"""Rest everything follows."""

import gymnasium as gym
import pytest
import torch

import isaaclab_tasks # noqa: F401
from isaaclab_tasks.core.cartpole.cartpole_direct_env_cfg import CartpoleEnvCfg
from isaaclab_tasks.utils.hydra import resolve_presets


@pytest.mark.isaacsim_ci
def test_cartpole_direct_physx_actuation_is_consistent_across_environments():
"""Verify that cloned PhysX carts respond consistently to a constant effort."""
cfg = resolve_presets(CartpoleEnvCfg(), ("physx",))
cfg.scene.num_envs = 4
cfg.sim.device = "cuda:0"
cfg.seed = 0
cfg.initial_cart_position_range = (0.0, 0.0)
cfg.initial_cart_velocity_range = (0.0, 0.0)
cfg.initial_pole_angle_range = (0.0, 0.0)
cfg.initial_pole_velocity_range = (0.0, 0.0)

env = gym.make("Isaac-Cartpole-Direct", cfg=cfg)
try:
env.reset()
actions = torch.ones(env.action_space.shape, device=env.unwrapped.device)
with torch.inference_mode():
for _ in range(20):
env.step(actions)

cart_idx = env.unwrapped._cart_dof_idx[0]
cart_vel = env.unwrapped.cartpole.data.joint_vel.torch[:, cart_idx]
assert torch.all(cart_vel > 1.0), f"Expected every cart to accelerate, got velocities {cart_vel.tolist()}."
torch.testing.assert_close(cart_vel, cart_vel[0].expand_as(cart_vel))
finally:
env.close()
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Loading