Skip to content

Updates PhysX external forces default to True#6523

Open
kellyguo11 wants to merge 6 commits into
isaac-sim:developfrom
kellyguo11:kellyg/default-external-forces-every-iteration
Open

Updates PhysX external forces default to True#6523
kellyguo11 wants to merge 6 commits into
isaac-sim:developfrom
kellyguo11:kellyg/default-external-forces-every-iteration

Conversation

@kellyguo11

Copy link
Copy Markdown
Contributor

Description

Default enable_external_forces_every_iteration to true for PhysX and warn when users opt out with the deprecated flag.

Add a deprecation warning and a breaking changelog fragment.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (existing functionality will not work without user modification)

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • 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
  • I have added my name to the CONTRIBUTORS.md or my name already exists there
Default enable_external_forces_every_iteration to true for PhysX and warn when users opt out with the deprecated flag.

Add regression coverage for the default scene attribute and the deprecation warning, plus a breaking changelog fragment.
@github-actions github-actions Bot added the isaac-lab Related to Isaac Lab team label Jul 14, 2026
Fold the noisy velocity guidance into the deprecation warning and remove the regression test coverage for this flag.
@greptile-apps

greptile-apps Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR changes the default value of enable_external_forces_every_iteration in PhysxCfg from False to True, and replaces the old logger.warning with a proper DeprecationWarning for users who explicitly opt out via False. A new test and a breaking changelog fragment accompany the change.

  • Default flip: physx_manager_cfg.py changes the field default to True and marks it deprecated in the docstring; users who relied on the False default will see a behaviour change without touching their config.
  • Deprecation warning: physx_manager.py emits DeprecationWarning only when solver_type == 1 (TGS) and the flag is False; PGS users who explicitly set False receive no warning even though the field itself will eventually be removed.
  • Test coverage: The new test validates the True default and the TGS deprecation path, but does not cover the PGS + False case where the warning is silently skipped.

Confidence Score: 4/5

Safe to merge; the core default-change and deprecation path work correctly for the vast majority of users who use the TGS solver.

The change is straightforward and the test validates both the new default and the TGS deprecation warning. The only gap is that PGS users who explicitly wrote enable_external_forces_every_iteration=False will never see the deprecation notice, meaning they could be surprised when the field is eventually removed.

physx_manager.py — the solver_type guard on the deprecation warning; physx_manager_cfg.py — the incomplete Sphinx directive.

Important Files Changed

Filename Overview
source/isaaclab_physx/isaaclab_physx/physics/physx_manager.py Replaces a logger.warning with a proper warnings.warn(DeprecationWarning) gated on solver_type==1 and enable_external_forces_every_iteration==False; warning is not emitted for PGS users who also set the flag to False.
source/isaaclab_physx/isaaclab_physx/physics/physx_manager_cfg.py Flips enable_external_forces_every_iteration default from False to True and adds a Sphinx deprecated directive; directive is missing its required version argument.
source/isaaclab/test/sim/test_simulation_context.py Adds a new test covering the default-True path and the DeprecationWarning path; both rely on solver_type=1 (TGS default) and the autouse fixture handles teardown correctly.
source/isaaclab_physx/changelog.d/kellyg-default-external-forces.major.rst New breaking-change changelog fragment; accurately describes the default change and the deprecation behaviour.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User creates PhysxCfg] --> B{enable_external_forces_every_iteration}
    B -->|not set - defaults to True| C[No warning emitted]
    B -->|explicitly set to True| C
    B -->|explicitly set to False| D{solver_type == 1 TGS?}
    D -->|Yes| E[warnings.warn DeprecationWarning]
    D -->|No PGS| F[No warning emitted]
    C --> G[Attribute written to USD physxScene]
    E --> G
    F --> G
    G --> H[PhysX simulation uses value]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[User creates PhysxCfg] --> B{enable_external_forces_every_iteration}
    B -->|not set - defaults to True| C[No warning emitted]
    B -->|explicitly set to True| C
    B -->|explicitly set to False| D{solver_type == 1 TGS?}
    D -->|Yes| E[warnings.warn DeprecationWarning]
    D -->|No PGS| F[No warning emitted]
    C --> G[Attribute written to USD physxScene]
    E --> G
    F --> G
    G --> H[PhysX simulation uses value]
Loading

Reviews (1): Last reviewed commit: "Refine PhysX external force warning" | Re-trigger Greptile

Comment on lines +682 to +688
if cfg.solver_type == 1 and not cfg.enable_external_forces_every_iteration:
logger.warning("TGS solver with enable_external_forces_every_iteration=False may cause noisy velocities.")
warnings.warn(
"PhysxCfg.enable_external_forces_every_iteration is deprecated and will be removed in a future "
"PhysX release. External forces are applied every iteration by default; remove this override. "
"Disabling this behavior with the TGS solver may cause noisy velocities.",
DeprecationWarning,
stacklevel=2,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Deprecation warning skips PGS users

The deprecation guard cfg.solver_type == 1 means users who explicitly set enable_external_forces_every_iteration=False with the PGS solver (solver_type=0) will never receive the deprecation warning. Although the flag is a no-op for PGS today, the deprecation notice says the field itself will be removed from PhysxCfg entirely, so PGS users who explicitly wrote enable_external_forces_every_iteration=False in their configs will still encounter a config error at that future removal point without ever being told to clean it up.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment thread source/isaaclab_physx/isaaclab_physx/physics/physx_manager_cfg.py Outdated
kellyguo11 and others added 3 commits July 14, 2026 13:57
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Signed-off-by: Kelly Guo <kellyg@nvidia.com>

@AntoineRichard AntoineRichard left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of behavioral changes which is a bit concerning, let's hope it doesn't show in training.


torch.testing.assert_close(
cube_object.data.root_lin_vel_w.torch, initial_velocity[:, :3], rtol=1e-5, atol=tolerance
cube_object.data.root_lin_vel_w.torch[:, :2], initial_velocity[:, :2], rtol=1e-5, atol=tolerance

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That change is odd, why not increase the tolerance?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was a friction test with object sliding on a surface, so in theory, the check is only necessary on the x and y axes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

isaac-lab Related to Isaac Lab team

2 participants