Repository navigation
Adds Initial Support for Multiple Simulation Backends - #4472
Conversation
Greptile OverviewGreptile SummaryThis PR introduces a multi-backend architecture to Isaac Lab 3.0, separating simulation backend-specific code (PhysX) from the core API. This is a foundational refactoring that enables future support for different physics backends. Key Changes
Architecture QualityThe refactoring follows solid software engineering principles with clear separation of concerns. The factory pattern implementation is clean, though the backend selection is currently hardcoded to Backward CompatibilityGood backward compatibility support through:
Testing & Documentation
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Articulation as Articulation(Factory)
participant FactoryBase
participant Module as isaaclab_physx.assets.articulation
participant PhysXArticulation as PhysXArticulation
participant BaseArticulation
User->>Articulation: Articulation(cfg)
Articulation->>FactoryBase: __new__(cls, cfg)
FactoryBase->>FactoryBase: backend = "physx" (hardcoded)
alt Backend not in registry
FactoryBase->>Module: importlib.import_module("isaaclab_physx.assets.articulation")
Module->>FactoryBase: Return module
FactoryBase->>Module: getattr(module, "Articulation")
Module->>FactoryBase: Return PhysXArticulation class
FactoryBase->>FactoryBase: register("physx", PhysXArticulation)
end
FactoryBase->>PhysXArticulation: __init__(cfg)
PhysXArticulation->>BaseArticulation: super().__init__(cfg)
BaseArticulation-->>PhysXArticulation: Initialized
PhysXArticulation-->>User: PhysXArticulation instance
Note over User,PhysXArticulation: User code sees Articulation but gets PhysXArticulation
Note over FactoryBase: Backend selection currently hardcoded to "physx"
|
| # TODO: Make the backend configurable. | ||
| backend = "physx" |
There was a problem hiding this comment.
Backend selection is hardcoded to "physx". Consider adding a configuration mechanism (e.g., environment variable, config file, or function parameter) to make the backend selectable before the 3.0 release.
| # TODO: Make the backend configurable. | |
| backend = "physx" | |
| # TODO: Make the backend configurable via environment variable or config | |
| backend = os.environ.get("ISAACLAB_BACKEND", "physx") |
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!
41756cf to
2bc7c41
Compare
ooctipus
left a comment
There was a problem hiding this comment.
Changes looks reasonable, LGTM :) Thanks!
|
LGTM! maybe we can disable the tests that we know will fail so that we can catch real failures more easily. we can also skip the environment tests for ones that haven't been updated yet. seems like a few of the environment training tests failed, which might not be expected. |
|
The outdated sensors fails but I'm not sure why tbh... It passes just fine locally. I fixed the mimic, they are doing things they shouldn't IMO, so I added some FIXMEs. The Pink IK consistently fails for me. I don't know why. This PR should make no difference to Pink. |
|
|
||
| @property | ||
| def default_fixed_tendon_limit(self) -> torch.Tensor: | ||
| """Deprecated property. Please use :attr:`default_fixed_tendon_pos_limits` instead.""" |
There was a problem hiding this comment.
could we use the python deprecationwarning module for deprecation warnings?
There was a problem hiding this comment.
Ah yes, that makes total sense. Didn't realize there was already a built-in decorator to do that
| @property | ||
| def default_mass(self) -> torch.Tensor: | ||
| """Removed: Default mass is no longer stored.""" | ||
| raise RuntimeError( |
There was a problem hiding this comment.
any reason why these are removed directly instead of deprecated and aliasing the getter APIs?
There was a problem hiding this comment.
Yes, defaults are just removed. They don't make sense IMO. They lead to excessive memory allocations I can deprecate them though, but I think this should a be a short cycle.
| # Minimum dependencies required prior to installation | ||
| INSTALL_REQUIRES = [ | ||
| # generic | ||
| "numpy<2", |
There was a problem hiding this comment.
maybe we can keep these in the base isaaclab extension unless they are specific for physx. might be difficult to track multiple versions of this in physx and newton directories.
|
|
||
| # Load Isaac Lab extensions last | ||
| "isaaclab" = {order = 1000} | ||
| "isaaclab_physx" = {order = 1000} |
There was a problem hiding this comment.
this would probably also be needed for all the other app files?
There was a problem hiding this comment.
I don't think we'll keep compatibility with IS4.5 will we? If not, I think all the changes are here for the apps.
| Changelog | ||
| --------- | ||
|
|
||
| 0.54.3 (2026-01-29) |
There was a problem hiding this comment.
this probably entitles a major version bump :)
| 0.0.3 (2026-01-29) | ||
| ~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| Updated |
There was a problem hiding this comment.
| Updated | |
| Changed |
| Changelog | ||
| --------- | ||
|
|
||
| 0.0.3 (2026-01-29) |
There was a problem hiding this comment.
this could probably also be a major version bump
There was a problem hiding this comment.
make sure to also update the version in extension.toml to align with this
|
Pink IK failure + Anymal C reward is a bit low, but it's not that much lower than the threshold or the quaternion PR. IMO it looks good. @kellyguo11do you think we could lower the Anymal C threshold and merge that in? |
|
yes let's update the thresholds. I tried to do a merge from develop after all the quaternion changes to resolve the merge conflicts - AntoineRichard#7. also updated the test thresholds there. unfortunately doesn't look like I can push to your fork directly |
Updates to latest develop and update test thresholds
Thanks @kellyguo11 |
…ow Hand restitution (#8320) # Description Training the Shadow Hand reorientation tasks with `presets=randomized` hit non-finite observations on every Kit PhysX and OvPhysX seed (5/5 each), and on the camera variant on Newton. This fixes the tendon randomization that caused it and the preset's restitution. 1. **Tendon randomization compounded.** `randomize_fixed_tendon_parameters` read the live tendon buffers its previous call had written, so with `operation="scale"` per-env stiffness and damping random-walked (8192-env probes: stiffness up to 1.4e12 on Kit PhysX, damping up to 1.4e6 on Newton); on Kit PhysX the fingers of drifted envs then tangle and the articulation goes non-finite. #4472 moved the term off the `default_fixed_tendon_*` properties, which are now deprecated with "The default value will need to be managed manually.", without managing the default in the term. The term now caches the tendon properties when it is created, as the joint randomization terms do, and randomizes from that copy. Limit stiffness, rest length and offset are read only when randomized: Newton raises `NotImplementedError` for them. 2. **Restitution was fixed at 1.0.** `randomize_rigid_body_material` requires a restitution range and samples absolute values, so the preset's `(1.0, 1.0)` made every hand and cube shape perfectly elastic. It now uses `(0.0, 0.0)`, the value without randomization. This does not cause the non-finite observations but slows learning on PhysX (table); a `(0.0, 0.2)` range left one of three Kit PhysX seeds unable to learn. 3. **Also affects** `IsaacContrib-Reorient-Cube-Shadow-OpenAI-{FF,LSTM}-Direct`, which always apply this randomization. 4. **Evidence** (`Isaac-Reorient-Cube-Shadow presets=randomized`, rsl_rl, task defaults, 3000 iterations; L40 GPUs, Kit PhysX in the Isaac Lab develop container): | Backend | develop | tendon fix only | this PR | |---|---|---|---| | Kit PhysX | NaN on 5/5 seeds (iteration 1165-1358) | no NaN on 3/3, SR 0.76 / 0.81 / 0.83 | no NaN on 5/5, SR 0.86-0.89 | | OvPhysX | NaN on 5/5 seeds (iteration 1016-1401) | no NaN on 3/3, SR 0.01 / 0.76 / 0.77 | no NaN on 5/5, SR 0.84-0.89 | | Newton MJWarp | no NaN on 7/7 seeds; NaN at step 1444 of a stress probe | — | stress probe clean for 4000 steps; no NaN on 5/5, SR 0.88-0.92 | The stress probe applies every reset term on every reset with action noise std 6 on 8192 envs. `Isaac-Reorient-Cube-Shadow-Camera` (1225 envs, 5000 iterations) shares the preset. On develop, Newton (Warp renderer) goes non-finite for seeds 42 / 43 / 44 at iteration 955 / 1204 / 709 and Kit PhysX (RTX) for seeds 42 / 43 at 3112 / 761; with this change, all five reach 5000 iterations without. Training ran on develop 174812c with an equivalent version of this change (see Validation). ## Validation - `uv run --frozen python -m pytest source/isaaclab/test/envs/test_event_requirements.py`: 19 passed. - `source/isaaclab_physx/test/envs/test_events.py -k fixed_tendon` in the Isaac Lab develop container: 3 passed. `test_fixed_tendon_parameters_do_not_compound` (`add` and `scale`) fails on develop. - Kit PhysX seed-43 replay of the training tree with this branch's `events.py`: success rate and mean reward match the trained run at iterations 1, 10, 50, 100, 200 and 300, and every logged metric at iteration 300 is identical. ## Type of change - Bug fix (non-breaking change which fixes an issue) ## Release backport - [x] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `develop` ## Screenshots Not applicable. ## Checklist - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/develop/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `uv run isaaclab --format` - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have validated the changed behavior with focused coverage and applied the [test-audit criteria](https://github.com/isaac-sim/IsaacLab/blob/develop/skills/developer/test-audit/SKILL.md) to any test changes - [x] I have added a changelog fragment under `source/<pkg>/changelog.d/` for every touched package - [x] My name already exists in `CONTRIBUTORS.md`
…ow Hand restitution (#8320) # Description Training the Shadow Hand reorientation tasks with `presets=randomized` hit non-finite observations on every Kit PhysX and OvPhysX seed (5/5 each), and on the camera variant on Newton. This fixes the tendon randomization that caused it and the preset's restitution. 1. **Tendon randomization compounded.** `randomize_fixed_tendon_parameters` read the live tendon buffers its previous call had written, so with `operation="scale"` per-env stiffness and damping random-walked (8192-env probes: stiffness up to 1.4e12 on Kit PhysX, damping up to 1.4e6 on Newton); on Kit PhysX the fingers of drifted envs then tangle and the articulation goes non-finite. #4472 moved the term off the `default_fixed_tendon_*` properties, which are now deprecated with "The default value will need to be managed manually.", without managing the default in the term. The term now caches the tendon properties when it is created, as the joint randomization terms do, and randomizes from that copy. Limit stiffness, rest length and offset are read only when randomized: Newton raises `NotImplementedError` for them. 2. **Restitution was fixed at 1.0.** `randomize_rigid_body_material` requires a restitution range and samples absolute values, so the preset's `(1.0, 1.0)` made every hand and cube shape perfectly elastic. It now uses `(0.0, 0.0)`, the value without randomization. This does not cause the non-finite observations but slows learning on PhysX (table); a `(0.0, 0.2)` range left one of three Kit PhysX seeds unable to learn. 3. **Also affects** `IsaacContrib-Reorient-Cube-Shadow-OpenAI-{FF,LSTM}-Direct`, which always apply this randomization. 4. **Evidence** (`Isaac-Reorient-Cube-Shadow presets=randomized`, rsl_rl, task defaults, 3000 iterations; L40 GPUs, Kit PhysX in the Isaac Lab develop container): | Backend | develop | tendon fix only | this PR | |---|---|---|---| | Kit PhysX | NaN on 5/5 seeds (iteration 1165-1358) | no NaN on 3/3, SR 0.76 / 0.81 / 0.83 | no NaN on 5/5, SR 0.86-0.89 | | OvPhysX | NaN on 5/5 seeds (iteration 1016-1401) | no NaN on 3/3, SR 0.01 / 0.76 / 0.77 | no NaN on 5/5, SR 0.84-0.89 | | Newton MJWarp | no NaN on 7/7 seeds; NaN at step 1444 of a stress probe | — | stress probe clean for 4000 steps; no NaN on 5/5, SR 0.88-0.92 | The stress probe applies every reset term on every reset with action noise std 6 on 8192 envs. `Isaac-Reorient-Cube-Shadow-Camera` (1225 envs, 5000 iterations) shares the preset. On develop, Newton (Warp renderer) goes non-finite for seeds 42 / 43 / 44 at iteration 955 / 1204 / 709 and Kit PhysX (RTX) for seeds 42 / 43 at 3112 / 761; with this change, all five reach 5000 iterations without. Training ran on develop 174812c with an equivalent version of this change (see Validation). ## Validation - `uv run --frozen python -m pytest source/isaaclab/test/envs/test_event_requirements.py`: 19 passed. - `source/isaaclab_physx/test/envs/test_events.py -k fixed_tendon` in the Isaac Lab develop container: 3 passed. `test_fixed_tendon_parameters_do_not_compound` (`add` and `scale`) fails on develop. - Kit PhysX seed-43 replay of the training tree with this branch's `events.py`: success rate and mean reward match the trained run at iterations 1, 10, 50, 100, 200 and 300, and every logged metric at iteration 300 is identical. ## Type of change - Bug fix (non-breaking change which fixes an issue) ## Release backport - [x] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `develop` ## Screenshots Not applicable. ## Checklist - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/develop/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `uv run isaaclab --format` - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have validated the changed behavior with focused coverage and applied the [test-audit criteria](https://github.com/isaac-sim/IsaacLab/blob/develop/skills/developer/test-audit/SKILL.md) to any test changes - [x] I have added a changelog fragment under `source/<pkg>/changelog.d/` for every touched package - [x] My name already exists in `CONTRIBUTORS.md` (cherry picked from commit 0f50f21)
Description
This PR introduces a multi-backend architecture for Isaac Lab asset classes, separating simulation backend-specific code from the core API. This enables future support for different physics backends while maintaining a consistent user-facing API.
Key Changes:
New isaaclab_physx Extension
A new extension containing PhysX-specific implementations of asset classes:
Abstract Base Classes in isaaclab
Deprecations
Migration Guide
Added comprehensive migration guide at docs/source/migration/migrating_to_isaaclab_3-0.rst with:
Type of change
Screenshots
Please attach before and after screenshots of the change if applicable.
Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there