Adds disable sleeping global flag for physx
Description
Introducing new PhysxCfg flag disable_sleeping to disable sleeping on a global level. This flag will now override per-object sleeping settings if set to True. If sleeping is desired for any object in the scene, ensure this flag is set to False. We are setting this to True by default to keep a consistent behavior between CPU and GPU simulation, since sleeping is not supported by PhysX on the GPU pipeline. This has also previously caused confusion for some users where the contact forces reported on CPU and GPU simulation were different due to sleeping.
Type of change
- New feature (non-breaking change which adds functionality)
- Breaking change (existing functionality will not work without user modification)
- Documentation update
Checklist
- [x] I have read and understood the contribution guidelines
- [x] I have run the
pre-commitchecks with./isaaclab.sh --format - [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my feature works
- [x] I have updated the changelog and the corresponding version in the extension's
config/extension.tomlfile - [ ] I have added my name to the
CONTRIBUTORS.mdor my name already exists there
enable_external_forces_every_iteration is setting for the TGS solver the applies external forces in lockstep with every solver step. This flag was previously not set, which we are keeping as the default behavior with setting it to False. However, this can introduce noisy joint velocities as some users have noticed. To avoid these artifacts, the flag can be set to True at the cost of minor performance hits (we measured around 4% for a scene with 2048 humanoids)
If the values are more correct, I think we should keep this flag as True by default. Most usecases where sim-to-real is concerned, bad joint velocities affects the deployment. In my experience, many users remove joint velocities from observations because of the jitteriness in the deployed behavior.
We should inform the users that if they care about performance, then they can disable these flags to get "approximated" values, but the default should try to remain a "correct" value.
Keeping external force flag independent in #3989
Greptile Overview
Greptile Summary
Adds a global disable_sleeping flag to PhysxCfg that overrides per-object sleeping settings, defaulting to True for CPU/GPU consistency since GPU pipeline doesn't support sleeping.
Key Changes:
- New
PhysxCfg.disable_sleepingparameter (default: True) insimulation_cfg.py:183-193 - Applied via
physxSceneAPI:disableSleepingUSD attribute insimulation_context.py:808-810 - Validation prevents unsupported GPU+sleeping combination in
simulation_context.py:798-806 - Comprehensive test coverage for default, CPU, and GPU validation scenarios
- Breaking change: users wanting sleeping on any object must now set this flag to False
Implementation Quality: All previously identified issues from earlier review rounds have been resolved - the attribute is properly set, validation logic is in place, and tests validate the expected behavior.
Confidence Score: 5/5
- This PR is safe to merge with minimal risk
- The implementation is clean and well-tested with proper validation, documentation, and tests covering all scenarios including the GPU incompatibility edge case
- No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| source/isaaclab/isaaclab/sim/simulation_context.py | 5/5 | Adds global sleep disabling with GPU validation - implementation looks correct with proper attribute setting and error handling for unsupported GPU+sleep=False combination |
| source/isaaclab/isaaclab/sim/simulation_cfg.py | 5/5 | Adds disable_sleeping config parameter with clear documentation and warning about GPU incompatibility |
| source/isaaclab/test/sim/test_simulation_context.py | 5/5 | Adds comprehensive tests for sleep disabling: default True, CPU with False, and GPU+False error validation |
Sequence Diagram
sequenceDiagram
participant User
participant SimulationCfg
participant SimulationContext
participant PhysxPrim
participant CarbSettings
User->>SimulationCfg: Create config with disable_sleeping=True (default)
User->>SimulationContext: Initialize SimulationContext(cfg)
SimulationContext->>SimulationContext: _configure_simulation_flags()
alt disable_sleeping is False
SimulationContext->>CarbSettings: get_as_bool("/physics/suppressReadback")
CarbSettings-->>SimulationContext: Returns GPU pipeline status
alt GPU pipeline enabled (suppressReadback=True)
SimulationContext->>User: RuntimeError: GPU + sleeping not supported
end
end
SimulationContext->>PhysxPrim: CreateAttribute("physxSceneAPI:disableSleeping")
SimulationContext->>PhysxPrim: Set(cfg.physx.disable_sleeping)
PhysxPrim-->>SimulationContext: Attribute applied globally
Note over PhysxPrim: Global sleeping disabled,<br/>overrides per-object settings