Fix contact sensor activation for nested rigid bodies#6259
Merged
ooctipus merged 3 commits intoJul 4, 2026
Merged
Conversation
ooctipus
requested review from
Mayankm96,
jtigue-bdai and
kellyguo11
as code owners
June 24, 2026 23:22
Contributor
StafaH
approved these changes
Jun 30, 2026
ooctipus
force-pushed
the
fix/activate-contact-sensors-nested-rigid-bodies
branch
from
July 2, 2026 03:44
f3c2201 to
2e853b0
Compare
7 tasks
hujc7
added a commit
that referenced
this pull request
Jul 17, 2026
…erarchy assets (#6377) # Description Spawning an asset whose rigid bodies are nested (child link prims authored under their parent link prim, as produced by the URDF importer in Isaac Sim 6.0 and later) only applied `rigid_props` and `mass_props` to the first link: the `apply_nested` decorator stops descending into a prim's children once the wrapped function succeeds, assuming physics schemas cannot nest. On a 29-link arm, `disable_gravity=True` reached 1/29 bodies with no warning. This completes the nested-hierarchy fix started in #6259 (which covered contact-sensor activation): - `apply_nested` gains a `stop_on_success` flag (default `True`; the dual-form decorator keeps every existing bare `@apply_nested` usage working unchanged). - `modify_rigid_body_properties` and `modify_mass_properties` opt out of the early stop, since their anchor prims are exactly the link prims that nest. - Regression test with a 3-deep nested rigid-body chain verifying both properties land on every body (mirrors the #6259 test). ## Scope: why only the rigid-body and mass writers An audit of the 40 asset stages referenced by `isaaclab_assets`/`isaaclab_tasks` informed the scoping: 1. Rigid-body nesting is the only *independent-anchor* nesting in use: `ShadowHandNewton` authors 24 of its 25 links body-under-body and is spawned with `rigid_props` by the shadow-hand task — this fix is required for those values to reach every link. 2. No joint-under-joint nesting and no nested articulation roots exist in any audited asset; keeping the early stop for those writers is safe. 3. Collider-under-collider exists only as duplicated same-intent anchors in a few props (e.g. the factory gear assets author `CollisionAPI` with SDF approximation on two ancestor Xforms of the same meshes, via layer composition). Those anchors describe the *same* geometry rather than independent colliders — the USD Physics spec ties `CollisionAPI` to leaf gprims, so nested Xform-level anchors have no defined precedence. Widening the traversal there would paper over an asset-level duplication instead of fixing schema application, so the collision writers keep the early stop; the asset duplication is being followed up separately. 4. Some flat assets (e.g. Franka) author `MassAPI` on both link prims and mesh prims beneath them. With this change `mass_props` now also authors the nested `MassAPI` prims; per the [USD Physics spec](https://openusd.org/release/wp_rigid_body_physics.html), a parent's explicit mass overrides mass properties authored further down the subtree, so effective per-body mass is unchanged. ## Behavior note The Newton shadow-hand task cfg sets `disable_gravity=True` (and related rigid-body properties) that previously reached only 1 of 25 links. With this fix the cfg applies to all 25 links as intended. This is the bug being fixed, but baselines tuned against the old (partial) behavior may shift for tasks whose assets have nested links. ## Verification - End-to-end through the spawner (`UsdFileCfg` → the same property-application path `UrdfFileCfg` uses) on a nested Geometry-scoped 3-link chain: `disable_gravity` and `mass` author on 1/3 bodies before the fix and 3/3 after; contact-report API 3/3 on both (via #6259). - New regression test in `test_schemas.py` (nested chain, asserts both properties on every link). - Full CI green (34/34 checks). Fixes #5918 ## Type of change - Bug fix (non-breaking change which fixes an issue) ## Checklist - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have added a changelog fragment under `source/<pkg>/changelog.d/` for every touched package (do **not** edit `CHANGELOG.rst` or bump `extension.toml` — CI handles that) - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_all_matching_child_primswhen activating PhysX contact report schemasPhysxContactReportAPITesting
Note
./isaaclab.sh -p -m pytest source/isaaclab_physx/test/sensors/test_contact_sensor.py -k contact_sensor_threshold -q, but collection failed becauseflakyis not installed in the local environment.