diff --git a/source/isaaclab/docs/CHANGELOG.rst b/source/isaaclab/docs/CHANGELOG.rst index 28dc76731f8..038a91480d2 100644 --- a/source/isaaclab/docs/CHANGELOG.rst +++ b/source/isaaclab/docs/CHANGELOG.rst @@ -1,6 +1,17 @@ Changelog --------- +0.48.1 (2025-11-10) +~~~~~~~~~~~~~~~~~~~ + +Added +^^^^^ + +* Added :attr:`~isaaclab.sim.PhysxCfg.enable_external_forces_every_iteration` to enable external forces every position iteration. + This can help improve the accuracy of velocity updates. Consider enabling this flag if the velocities generated by the simulation are noisy. +* Added warning when :attr:`~isaaclab.sim.PhysxCfg.enable_external_forces_every_iteration` is set to False and the solver type is TGS. + + 0.48.0 (2025-11-03) ~~~~~~~~~~~~~~~~~~~ diff --git a/source/isaaclab/isaaclab/sim/simulation_cfg.py b/source/isaaclab/isaaclab/sim/simulation_cfg.py index 380dba26c51..81acb3f1c87 100644 --- a/source/isaaclab/isaaclab/sim/simulation_cfg.py +++ b/source/isaaclab/isaaclab/sim/simulation_cfg.py @@ -99,6 +99,19 @@ class PhysxCfg: Enabling this flag may lead to incorrect contact forces report from the contact sensor. """ + enable_external_forces_every_iteration: bool = False + """Enable/disable external forces every position iteration in the TGS solver. Default is False. + + When using the TGS solver (:attr:`solver_type` is 1), this flag allows enabling external forces every solver position iteration. + This can help improve the accuracy of velocity updates. Consider enabling this flag if the velocities generated by + the simulation are noisy. Increasing the number of velocity iterations, together with this flag, can help improve + the accuracy of velocity updates. + + .. note:: + + This flag is ignored when using the PGS solver (:attr:`solver_type` is 0). + """ + 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 83277635acf..4e0bf20a75d 100644 --- a/source/isaaclab/isaaclab/sim/simulation_context.py +++ b/source/isaaclab/isaaclab/sim/simulation_context.py @@ -792,6 +792,19 @@ def _set_additional_physx_params(self): physx_prim.CreateAttribute("physxScene:solveArticulationContactLast", Sdf.ValueTypeNames.Bool).Set( self.cfg.physx.solve_articulation_contact_last ) + # -- Enable external forces every iteration, helps improve the accuracy of velocity updates. + + if self.cfg.physx.solver_type == 1: + if not self.cfg.physx.enable_external_forces_every_iteration: + omni.log.warn( + "The `enable_external_forces_every_iteration` parameter in the PhysxCfg is set to False. If you are" + " experiencing noisy velocities, consider enabling this flag. You may need to slightly increase the" + " number of velocity iterations (setting it to 1 or 2 rather than 0), together with this flag, to" + " improve the accuracy of velocity updates." + ) + physx_scene_api.CreateEnableExternalForcesEveryIterationAttr( + self.cfg.physx.enable_external_forces_every_iteration + ) # -- Gravity # note: Isaac sim only takes the "up-axis" as the gravity direction. But physics allows any direction so we