From 3e5c224b18a20d733d2bfccd25e9d61a6aa7d69e Mon Sep 17 00:00:00 2001 From: Antoine Richard Date: Mon, 10 Nov 2025 15:20:17 +0100 Subject: [PATCH 1/5] Fix noisy velocities around limits. --- source/isaaclab/isaaclab/sim/simulation_cfg.py | 8 ++++++++ source/isaaclab/isaaclab/sim/simulation_context.py | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/source/isaaclab/isaaclab/sim/simulation_cfg.py b/source/isaaclab/isaaclab/sim/simulation_cfg.py index 380dba26c51..288e4971a13 100644 --- a/source/isaaclab/isaaclab/sim/simulation_cfg.py +++ b/source/isaaclab/isaaclab/sim/simulation_cfg.py @@ -99,6 +99,14 @@ 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 iteration. Default is False. + + This flag allows enabling external forces every 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. + """ + 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..b48785b4af7 100644 --- a/source/isaaclab/isaaclab/sim/simulation_context.py +++ b/source/isaaclab/isaaclab/sim/simulation_context.py @@ -792,6 +792,13 @@ 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 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 From 01dd15d0cdb1c8c8943ad75980dcd9d4ca8b78ec Mon Sep 17 00:00:00 2001 From: Antoine Richard Date: Mon, 10 Nov 2025 15:22:19 +0100 Subject: [PATCH 2/5] added Changelog --- source/isaaclab/docs/CHANGELOG.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/source/isaaclab/docs/CHANGELOG.rst b/source/isaaclab/docs/CHANGELOG.rst index 28dc76731f8..4b934b3ea3a 100644 --- a/source/isaaclab/docs/CHANGELOG.rst +++ b/source/isaaclab/docs/CHANGELOG.rst @@ -1,6 +1,21 @@ Changelog --------- +0.48.1 (2025-11-10) +~~~~~~~~~~~~~~~~~~~ + +Added +^^^^^ + +* Added :attr:`~isaaclab.sim.SimulationCfg.enable_external_forces_every_iteration` to enable external forces every iteration. + This can help improve the accuracy of velocity updates. Consider enabling this flag if the velocities generated by the simulation are noisy. + +Changed +^^^^^^^ + +* Added warning when :attr:`~isaaclab.sim.SimulationCfg.enable_external_forces_every_iteration` is set to False. + + 0.48.0 (2025-11-03) ~~~~~~~~~~~~~~~~~~~ From f18dbd5c5cf1a6c8a2c3e7e20cd24a26db1b1f42 Mon Sep 17 00:00:00 2001 From: Antoine Richard Date: Mon, 10 Nov 2025 15:22:50 +0100 Subject: [PATCH 3/5] applied pre-commits --- source/isaaclab/isaaclab/sim/simulation_context.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/source/isaaclab/isaaclab/sim/simulation_context.py b/source/isaaclab/isaaclab/sim/simulation_context.py index b48785b4af7..4939710cf45 100644 --- a/source/isaaclab/isaaclab/sim/simulation_context.py +++ b/source/isaaclab/isaaclab/sim/simulation_context.py @@ -795,10 +795,14 @@ def _set_additional_physx_params(self): # -- Enable external forces every iteration, helps improve the accuracy of velocity updates. 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." + "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) + 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 From 849b256cd224e3be777e6a187d1e8e0cb5f271b1 Mon Sep 17 00:00:00 2001 From: Antoine Richard Date: Mon, 10 Nov 2025 15:32:55 +0100 Subject: [PATCH 4/5] Added clarifications around the fact that this is only true for the TGS solver. --- .../isaaclab/isaaclab/sim/simulation_cfg.py | 11 +++++++--- .../isaaclab/sim/simulation_context.py | 20 ++++++++++--------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/source/isaaclab/isaaclab/sim/simulation_cfg.py b/source/isaaclab/isaaclab/sim/simulation_cfg.py index 288e4971a13..a13433682c9 100644 --- a/source/isaaclab/isaaclab/sim/simulation_cfg.py +++ b/source/isaaclab/isaaclab/sim/simulation_cfg.py @@ -102,9 +102,14 @@ class PhysxCfg: enable_external_forces_every_iteration: bool = False """Enable/disable external forces every iteration. Default is False. - This flag allows enabling external forces every 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. + When using the TGS solver (:attr:`solver_type` is 1), this flag allows enabling external forces every 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 diff --git a/source/isaaclab/isaaclab/sim/simulation_context.py b/source/isaaclab/isaaclab/sim/simulation_context.py index 4939710cf45..4e0bf20a75d 100644 --- a/source/isaaclab/isaaclab/sim/simulation_context.py +++ b/source/isaaclab/isaaclab/sim/simulation_context.py @@ -793,16 +793,18 @@ def _set_additional_physx_params(self): self.cfg.physx.solve_articulation_contact_last ) # -- Enable external forces every iteration, helps improve the accuracy of velocity updates. - 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." + + 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 ) - 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 From 34b748e352fbaee72c51e8b389fa9d6b54d77ad6 Mon Sep 17 00:00:00 2001 From: Antoine Richard Date: Mon, 10 Nov 2025 15:38:11 +0100 Subject: [PATCH 5/5] Updated with feedback from Gordon. --- source/isaaclab/docs/CHANGELOG.rst | 8 ++------ source/isaaclab/isaaclab/sim/simulation_cfg.py | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/source/isaaclab/docs/CHANGELOG.rst b/source/isaaclab/docs/CHANGELOG.rst index 4b934b3ea3a..038a91480d2 100644 --- a/source/isaaclab/docs/CHANGELOG.rst +++ b/source/isaaclab/docs/CHANGELOG.rst @@ -7,13 +7,9 @@ Changelog Added ^^^^^ -* Added :attr:`~isaaclab.sim.SimulationCfg.enable_external_forces_every_iteration` to enable external forces every iteration. +* 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. - -Changed -^^^^^^^ - -* Added warning when :attr:`~isaaclab.sim.SimulationCfg.enable_external_forces_every_iteration` is set to False. +* 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 a13433682c9..81acb3f1c87 100644 --- a/source/isaaclab/isaaclab/sim/simulation_cfg.py +++ b/source/isaaclab/isaaclab/sim/simulation_cfg.py @@ -100,9 +100,9 @@ class PhysxCfg: """ enable_external_forces_every_iteration: bool = False - """Enable/disable external forces every iteration. Default is 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 iteration. + 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.