From 54e62401027b8e30918b775d4f337db50853aea9 Mon Sep 17 00:00:00 2001 From: Antoine Richard Date: Tue, 19 May 2026 14:00:35 +0200 Subject: [PATCH 1/2] Simple perf opt to avoid routing through the composer when not needed. --- source/isaaclab/isaaclab/envs/mdp/events.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/isaaclab/isaaclab/envs/mdp/events.py b/source/isaaclab/isaaclab/envs/mdp/events.py index 9483d2d2d0cd..bcda248bee07 100644 --- a/source/isaaclab/isaaclab/envs/mdp/events.py +++ b/source/isaaclab/isaaclab/envs/mdp/events.py @@ -1631,6 +1631,10 @@ def apply_external_force_torque( # resolve number of bodies num_bodies = len(asset_cfg.body_ids) if isinstance(asset_cfg.body_ids, list) else asset.num_bodies + # Skip force application if the wrench ranges are zero + if force_range[0] == 0.0 and force_range[1] == 0.0 and torque_range[0] == 0.0 and torque_range[1] == 0.0: + return + # sample random forces and torques size = (len(env_ids), num_bodies, 3) forces = math_utils.sample_uniform(*force_range, size, asset.device) From cbd4efb4d6e4027c2888ad5c4950da91155c8615 Mon Sep 17 00:00:00 2001 From: Antoine Richard Date: Tue, 19 May 2026 14:10:39 +0200 Subject: [PATCH 2/2] Add changelog fragment for zero-wrench fast path Documents the early-return added to apply_external_force_torque when force_range and torque_range are both zero, restoring H1/G1/Anymal-C Velocity-Rough throughput regressed by the WrenchComposer rework in #5265. Refs: isaac-sim/IsaacLab-Internal#906, isaac-sim/IsaacLab-Internal#911 --- .../changelog.d/fix-zero-wrench-fast-path.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 source/isaaclab/changelog.d/fix-zero-wrench-fast-path.rst diff --git a/source/isaaclab/changelog.d/fix-zero-wrench-fast-path.rst b/source/isaaclab/changelog.d/fix-zero-wrench-fast-path.rst new file mode 100644 index 000000000000..1521e8f9db31 --- /dev/null +++ b/source/isaaclab/changelog.d/fix-zero-wrench-fast-path.rst @@ -0,0 +1,12 @@ +Fixed +^^^^^ + +* Fixed a per-step performance regression in :func:`~isaaclab.envs.mdp.events.apply_external_force_torque` + when the event was configured with all-zero ``force_range`` and ``torque_range`` (a common default + for tasks that declare the event term but apply no disturbance). The event was unconditionally + sampling zero wrenches and routing them through the dual-buffer ``WrenchComposer`` introduced in + PR #5265, paying the full per-step compose-and-apply cost in + :meth:`~isaaclab.assets.Articulation.write_data_to_sim` for what is semantically a no-op. The + function now returns early when both ranges are exactly zero. This restores the H1, G1, and + Anymal-C ``Velocity-Rough`` throughput observed prior to PR #5265. Behaviour for non-zero ranges + is unchanged.