Skip to content

Commit 13965cc

Browse files
Sets enable_stabilization to false by default. (#2628)
# Description Changes the default setting for the enable stabilization flag from True to False. Fixes #2319 ## Type of change - Bug fix (non-breaking change which fixes an issue) ## Screenshots | Before | After | :-------------------------:|:-------------------------: ![net_contact_forces_1kz](https://github.com/user-attachments/assets/a9d7851c-d42a-4f22-8ea7-6b187070057e)| ![net_contact_forces_after](https://github.com/user-attachments/assets/523b8b5c-d8db-435c-bb66-c4312d2c6c18) ![force_matrices_1khz](https://github.com/user-attachments/assets/30feb2e1-d1f6-402f-8ca0-3a727bce4424) | ![force_matrices_after](https://github.com/user-attachments/assets/3294335f-c5d5-4c4d-ac8a-e2c2e995e2a0) ## Checklist - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there --------- Signed-off-by: Antoine RICHARD <antoiner@nvidia.com> Co-authored-by: Mayank Mittal <12863862+Mayankm96@users.noreply.github.com>
1 parent cee5027 commit 13965cc

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

source/isaaclab/isaaclab/sim/simulation_cfg.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,17 @@ class PhysxCfg:
8787
"""Enable a second broad-phase pass that makes it possible to prevent objects from tunneling through each other.
8888
Default is False."""
8989

90-
enable_stabilization: bool = True
91-
"""Enable/disable additional stabilization pass in solver. Default is True."""
90+
enable_stabilization: bool = False
91+
"""Enable/disable additional stabilization pass in solver. Default is False.
92+
93+
.. note::
94+
95+
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).
96+
97+
.. warn::
98+
99+
Enabling this flag may lead to incorrect contact forces report from the contact sensor.
100+
"""
92101

93102
enable_enhanced_determinism: bool = False
94103
"""Enable/disable improved determinism at the expense of performance. Defaults to False.

source/isaaclab/isaaclab/sim/simulation_context.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,14 @@ def __init__(self, cfg: SimulationCfg | None = None):
234234
physx_params = sim_params.pop("physx")
235235
sim_params.update(physx_params)
236236
# create a simulation context to control the simulator
237+
238+
if not self.cfg.physx.enable_stabilization and (self.cfg.dt > 0.0333):
239+
omni.log.warn(
240+
"Large simulation step size (> 0.0333 seconds) is not recommended without enabling stabilization."
241+
" Consider setting the `enable_stabilization` flag to True in the PhysxCfg, or reducing the"
242+
" simulation step size if you run into physics issues."
243+
)
244+
237245
super().__init__(
238246
stage_units_in_meters=1.0,
239247
physics_dt=self.cfg.dt,

source/isaaclab/test/assets/test_rigid_object.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ def test_rigid_body_with_static_friction(num_cubes, device):
591591
cube_object.update(sim.cfg.dt)
592592
if force == "below_mu":
593593
# Assert that the block has not moved
594-
torch.testing.assert_close(cube_object.data.root_pos_w, initial_root_pos, rtol=1e-3, atol=1e-3)
594+
torch.testing.assert_close(cube_object.data.root_pos_w, initial_root_pos, rtol=2e-3, atol=2e-3)
595595
if force == "above_mu":
596596
assert (cube_object.data.root_state_w[..., 0] - initial_root_pos[..., 0] > 0.02).all()
597597

@@ -848,8 +848,8 @@ def test_body_root_state_properties(num_cubes, device, with_offset):
848848
lin_vel_rel_root_gt = quat_apply_inverse(root_link_state_w[..., 3:7], root_link_state_w[..., 7:10])
849849
lin_vel_rel_body_gt = quat_apply_inverse(body_link_state_w[..., 3:7], body_link_state_w[..., 7:10])
850850
lin_vel_rel_gt = torch.linalg.cross(spin_twist.repeat(num_cubes, 1)[..., 3:], -offset)
851-
torch.testing.assert_close(lin_vel_rel_gt, lin_vel_rel_root_gt, atol=1e-4, rtol=1e-4)
852-
torch.testing.assert_close(lin_vel_rel_gt, lin_vel_rel_body_gt.squeeze(-2), atol=1e-4, rtol=1e-4)
851+
torch.testing.assert_close(lin_vel_rel_gt, lin_vel_rel_root_gt, atol=1e-3, rtol=1e-3)
852+
torch.testing.assert_close(lin_vel_rel_gt, lin_vel_rel_body_gt.squeeze(-2), atol=1e-3, rtol=1e-3)
853853

854854
# ang_vel will always match
855855
torch.testing.assert_close(root_state_w[..., 10:], root_com_state_w[..., 10:])

0 commit comments

Comments
 (0)