You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix fragment writers to modify existing rigid-body, collision, and mass prims (#6501)
# Description
The `apply_rigid_body_properties`, `apply_collision_properties`, and
`apply_mass_properties` fragment family writers force-applied their
defining USD API (`RigidBodyAPI` / `CollisionAPI` / `MassAPI`) directly
on the input prim. The legacy writers they replace are `@apply_nested`:
they modify the prims that *already carry* the API and never author a
fresh one.
For bare-prim spawns (shapes, meshes) the define-fresh behavior is
correct, which is why all existing tests passed. The failure needs a
real USD asset: robot assets author `RigidBodyAPI` on their **link**
prims and (commonly) `ArticulationRootAPI` on the **spawn** prim.
Configuring `rigid_props` as a fragment list on such an asset
force-anchored a new rigid body on the spawn prim, turning every link
into a nested rigid body — the PhysX parser then drops the
articulation's joint graph (`Articulation` initialization fails with an
empty joint registry). Reproduced A/B on the cartpole asset.
## Fix
Resolve targets the way the legacy nested writers do, mirroring the
articulation-root writer's existing pattern: collect subtree prims
already carrying the defining API (breadth-first, without descending
past a match — nested applications of the same physics schema are not
allowed), dispatch every fragment to each; apply a fresh API on the
input prim **only** when the subtree carries none (presence-gated),
preserving the bare-prim spawner behavior. Instanced prims are skipped
with a warning. The shared resolution lives in one helper used by all
three writers.
## Tests
New `test_schema_writer_nested_targets.py` (all fail before the fix,
pass after):
- fragment `rigid_props`/`collision_props`/`mass_props` through the
production USD spawn path on an articulated asset: attributes land on
the links/colliders, the spawn prim gains no anchor;
- fragment vs legacy path on the same asset: identical per-prim
applied-schema sets and authored attributes;
- bare-prim define-fresh preserved; traversal does not descend past an
existing body.
Existing suites re-run green: schema/collision/mass/mesh-collision
fragments, spawn meshes, schemas (101 tests total).
## 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`
- [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/`
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
---------
Co-authored-by: Octi Zhang <zhengyuz@nvidia.com>
0 commit comments