Fix fragment writers to reach nested rigid-body and mass prims#6635
Fix fragment writers to reach nested rigid-body and mass prims#6635vidurv-nvidia wants to merge 1 commit into
Conversation
The fragment target resolver stopped descending at the first schema-bearing prim on each branch, so on assets with nested rigid-body hierarchies (child links authored under their parent link prims, as produced by the URDF importer in Isaac Sim 6.0 and later) only the outermost link received rigid-body and mass fragment properties. The legacy writers gained full-subtree traversal for these families in isaac-sim#6377, so the fragment writers diverged from legacy parity. Add a stop_at_carrier flag to the resolver, mirroring apply_nested's stop_on_success: rigid-body and mass writers now collect every carrier in the subtree, while collision keeps the legacy stop-at-carrier traversal. Extend the nested-target regression tests with a nested child link so the flat-asset, parity, and direct-writer tests all cover the nested topology.
Greptile SummaryThis PR fixes a traversal bug in the fragment-based physics writers (
Confidence Score: 5/5Safe to merge. The traversal logic change is minimal, well-contained in a private helper, and each public writer explicitly opts in or out of the new behaviour. The fix is a single guarded No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["_resolve_fragment_targets"] --> B["BFS queue = [root prim]"]
B --> C{Next candidate in queue?}
C -- No --> E{targets empty AND apply_fresh?}
C -- Yes --> D{candidate.HasAPI api_type?}
D -- No --> H["Add GetFilteredChildren to queue"]
H --> C
D -- Yes --> F{IsInstance or IsInstanceProxy?}
F -- Yes --> G["skipped.append(candidate)"]
F -- No --> I["targets.append(candidate)"]
G --> J{stop_at_carrier?}
I --> J
J -- True --> K["continue skip children"]
K --> C
J -- False --> H
E -- Yes --> L["Apply api_type to prim_path"]
E -- No --> M["Return targets, bool skipped"]
L --> M
N["apply_rigid_body_properties"] -->|stop_at_carrier=False| A
O["apply_mass_properties"] -->|stop_at_carrier=False| A
P["apply_collision_properties"] -->|stop_at_carrier=True| A
%%{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["_resolve_fragment_targets"] --> B["BFS queue = [root prim]"]
B --> C{Next candidate in queue?}
C -- No --> E{targets empty AND apply_fresh?}
C -- Yes --> D{candidate.HasAPI api_type?}
D -- No --> H["Add GetFilteredChildren to queue"]
H --> C
D -- Yes --> F{IsInstance or IsInstanceProxy?}
F -- Yes --> G["skipped.append(candidate)"]
F -- No --> I["targets.append(candidate)"]
G --> J{stop_at_carrier?}
I --> J
J -- True --> K["continue skip children"]
K --> C
J -- False --> H
E -- Yes --> L["Apply api_type to prim_path"]
E -- No --> M["Return targets, bool skipped"]
L --> M
N["apply_rigid_body_properties"] -->|stop_at_carrier=False| A
O["apply_mass_properties"] -->|stop_at_carrier=False| A
P["apply_collision_properties"] -->|stop_at_carrier=True| A
Reviews (1): Last reviewed commit: "Fix fragment writers to reach nested rig..." | Re-trigger Greptile |
|
Superseded by #6640: the fragment writers are moving from subtree traversal to explicit prim-path-expression targeting, which removes the traversal policy this PR patched. The nested-hierarchy regression tests and the fix itself are carried inside #6640 (this branch is part of its history), so nested URDF-importer assets are covered there. Closing to keep a single review surface — the fragment path is still experimental, so there is no released behavior needing an interim fix. |
Description
Follow-up reconciling the fragment writers with #6377, which merged the same day as #6501.
#6377 established that nested rigid-body hierarchies are legitimate asset topology: the URDF importer in Isaac Sim 6.0 and later authors child links under their parent link prims. It fixed the legacy
modify_rigid_body_properties/modify_mass_propertiespath viaapply_nested(stop_on_success=False)so every link is reached. The fragment target resolver introduced in #6501 still stops descending at the first schema-bearing prim on each branch, so on such assets the fragment path modifies only the outermost link — silently reproducing the exact 1-of-N-links bug #6377 fixed on the legacy path.This PR restores legacy parity:
_resolve_fragment_targetsgains astop_at_carrierflag mirroringapply_nested'sstop_on_success. The rigid-body and mass fragment writers now collect every carrier in the subtree; the collision writer keeps stop-at-carrier traversal, matching the legacy collision writer, which [Fix] Apply rigid-body and mass properties to every link of nested-hierarchy assets #6377 left on the default.Fixes the fragment-path counterpart of #6377.
Type of change
Checklist
pre-commitchecks with./isaaclab.sh --formatCONTRIBUTORS.mdor my name already exists there