diff --git a/source/isaaclab/isaaclab/sim/simulation_cfg.py b/source/isaaclab/isaaclab/sim/simulation_cfg.py index e56389b3262..cbfed1ed0a9 100644 --- a/source/isaaclab/isaaclab/sim/simulation_cfg.py +++ b/source/isaaclab/isaaclab/sim/simulation_cfg.py @@ -87,8 +87,17 @@ class PhysxCfg: """Enable a second broad-phase pass that makes it possible to prevent objects from tunneling through each other. Default is False.""" - enable_stabilization: bool = True - """Enable/disable additional stabilization pass in solver. Default is True.""" + enable_stabilization: bool = False + """Enable/disable additional stabilization pass in solver. Default is False. + + .. note:: + + We recommend setting this flag to true only when the simulation step size is large (i.e., less than 30 Hz or more than 0.0333 seconds). + + .. warn:: + + Enabling this flag may lead to incorrect contact forces report from the contact sensor. + """ enable_enhanced_determinism: bool = False """Enable/disable improved determinism at the expense of performance. Defaults to False. diff --git a/source/isaaclab/isaaclab/sim/simulation_context.py b/source/isaaclab/isaaclab/sim/simulation_context.py index 82e72074147..45956ae936b 100644 --- a/source/isaaclab/isaaclab/sim/simulation_context.py +++ b/source/isaaclab/isaaclab/sim/simulation_context.py @@ -234,6 +234,14 @@ def __init__(self, cfg: SimulationCfg | None = None): physx_params = sim_params.pop("physx") sim_params.update(physx_params) # create a simulation context to control the simulator + + if not self.cfg.physx.enable_stabilization and (self.cfg.dt > 0.0333): + omni.log.warn( + "Large simulation step size (> 0.0333 seconds) is not recommended without enabling stabilization." + " Consider setting the `enable_stabilization` flag to True in the PhysxCfg, or reducing the" + " simulation step size if you run into physics issues." + ) + super().__init__( stage_units_in_meters=1.0, physics_dt=self.cfg.dt, diff --git a/source/isaaclab/test/assets/test_rigid_object.py b/source/isaaclab/test/assets/test_rigid_object.py index 6dc7b0b7d77..5c2be6508ff 100644 --- a/source/isaaclab/test/assets/test_rigid_object.py +++ b/source/isaaclab/test/assets/test_rigid_object.py @@ -591,7 +591,7 @@ def test_rigid_body_with_static_friction(num_cubes, device): cube_object.update(sim.cfg.dt) if force == "below_mu": # Assert that the block has not moved - torch.testing.assert_close(cube_object.data.root_pos_w, initial_root_pos, rtol=1e-3, atol=1e-3) + torch.testing.assert_close(cube_object.data.root_pos_w, initial_root_pos, rtol=2e-3, atol=2e-3) if force == "above_mu": assert (cube_object.data.root_state_w[..., 0] - initial_root_pos[..., 0] > 0.02).all() @@ -848,8 +848,8 @@ def test_body_root_state_properties(num_cubes, device, with_offset): lin_vel_rel_root_gt = quat_apply_inverse(root_link_state_w[..., 3:7], root_link_state_w[..., 7:10]) lin_vel_rel_body_gt = quat_apply_inverse(body_link_state_w[..., 3:7], body_link_state_w[..., 7:10]) lin_vel_rel_gt = torch.linalg.cross(spin_twist.repeat(num_cubes, 1)[..., 3:], -offset) - torch.testing.assert_close(lin_vel_rel_gt, lin_vel_rel_root_gt, atol=1e-4, rtol=1e-4) - torch.testing.assert_close(lin_vel_rel_gt, lin_vel_rel_body_gt.squeeze(-2), atol=1e-4, rtol=1e-4) + torch.testing.assert_close(lin_vel_rel_gt, lin_vel_rel_root_gt, atol=1e-3, rtol=1e-3) + torch.testing.assert_close(lin_vel_rel_gt, lin_vel_rel_body_gt.squeeze(-2), atol=1e-3, rtol=1e-3) # ang_vel will always match torch.testing.assert_close(root_state_w[..., 10:], root_com_state_w[..., 10:])