Skip to content

Match Newton rigid object collection bodies exactly - #8175

Merged
ooctipus merged 2 commits into
isaac-sim:developfrom
yusufdxb:fix/newton-collection-exact-match
Sep 30, 2026
Merged

ooctipus merged 2 commits into
isaac-sim:developfrom
yusufdxb:fix/newton-collection-exact-match

Conversation

@yusufdxb

@yusufdxb yusufdxb commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Description

The Newton RigidObjectCollection merged its members' prim path expressions into one wildcard glob (_build_combined_pattern), because older Newton could not accept a list of patterns. That approximation has two failures:

  • It over-matches rigid bodies with similar names. With members Object_A and Object_B, the glob /World/Env_*/Object_* also selects an unrelated Object_Target in the same environment, and initialization fails with RuntimeError: ... matched 3 objects per world, but the collection config contains 2.
  • It cannot represent members at different hierarchy depths. Object_A and Shelf/Object_B fail with ValueError: Cannot build combined pattern: path expressions have different segment counts.

Newton 1.6.0, the pinned version, accepts the individual patterns: ArticulationView matches each label against a list of globs. This PR passes the members' patterns directly, as suggested in #6147, and removes the obsolete wildcard-merging workaround. This matches the PhysX collection, which already passes the list to create_rigid_body_view.

The per-world count check is kept. Newton matches each body once, so two members whose prim paths resolve to the same prim produce one match per world. Without the check, a 4-environment scene with such an aliased pair initializes without error, but it reports num_instances=2 and a pose buffer of shape (4, 1, 3). With the check, it raises a clear error.

Fixes #6147

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Test

Extended the existing Newton test_initialization in source/isaaclab_newton/test/assets/test_rigid_object_collection.py; no separate regression test or fixture was added. The cases cover a single member, an unrelated Object_Target alongside Object_A/B/C, and members at different depths (Object_A and Shelf/Object_B). All run on CPU and CUDA and check each body's name-to-pose mapping as well as view counts and buffer shapes.

The two regression cases fail against the original implementation at eb6617cda and pass with the fix.

Local collection-suite validation:

Backend Devices Result
Newton 1.6.0 CPU and CUDA 22 passed
OVPhysX 0.6.3 CPU and CUDA 28 passed
Kit PhysX CPU and CUDA 38 passed

Separate local cross-backend checks also passed both path cases on each backend, including targeted pose writes, stepping, and reset. The consolidated Newton suite was rerun after the test cleanup; the PhysX and OVPhysX implementations were unchanged.

uv run --no-sync isaaclab -f passed, including the changelog check.

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with uv run isaaclab --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have validated the changed behavior with focused coverage and applied the test-audit criteria to any test changes
  • I have added a changelog fragment under source/<pkg>/changelog.d/ for every touched package (do not edit CHANGELOG.rst or bump package versions; CI handles that)
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

The Newton RigidObjectCollection merged the members' prim path
expressions into one glob by wildcarding the differing part of each
path segment. The merged glob also matched other rigid bodies whose
names share the members' prefix and suffix, which failed the
per-world count check, and it could not be built at all when members
sit at different depths below the environment.

Pass the list of member expressions to ArticulationView, which
matches each label against the list, so the view binds exactly the
configured prims, as the PhysX collection already does.

Signed-off-by: Yusuf Guenena <[email protected]>
@yusufdxb
yusufdxb requested a review from a team September 29, 2026 21:38
@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Sep 29, 2026
@yusufdxb

Copy link
Copy Markdown
Contributor Author

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Sep 29, 2026
@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium risk] Changes how rigid body collections match configured objects.

The PR appears safe to merge; a reversed-order regression case would strengthen coverage of body-name bindings.

Findings

  1. P2 Member ordering remains untested ▶

Summary

The PR replaces Newton’s merged collection glob with individual member patterns, retaining the per-world count check. It also adds sibling and nested-path regression cases and a changelog fragment.

Reviews (1) · Last reviewed commit: "Match Newton rigid object collection bod..."

Comment on lines +257 to +259
(("Object_A", "Object_B"), ("Object_Target",)),
# members at different depths below the environment
(("Object_A", "Shelf/Object_B"), ()),

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 Member ordering remains untested. Both new cases configure Object_A before Object_B, so the pose checks cannot catch a mismatch between body names and view slots when configuration order differs from path order. Add a reversed-order case with distinct poses; otherwise this regression test could miss incorrect reads or writes for those configurations.

Knowledge Base Used: Newton backend

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!

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

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.

Isaac Lab Review Bot

The change replaces Newton’s approximate combined wildcard with the ordered list of configured rigid-body globs, preserving count validation and adding focused regressions for prefix collisions and mixed hierarchy depths. No blocking issues were identified.

  • Design and architecture: The exact-match behavior remains localized to the Newton RigidObjectCollection initialization boundary. Removing _build_combined_pattern and its unused os import eliminates the obsolete workaround, while the existing per-world count validation remains the single guard against aliased or otherwise incomplete member bindings.
  • API: The public RigidObjectCollection surface remains unchanged: configuration, body-name ordering, root_view, num_instances, and find_bodies continue through the same paths. The deleted _build_combined_pattern method is private, and no supplied consumer depends on it.
  • Compatibility and deprecation: Breaking changes: none identified. Mixed-depth member paths become newly supported, exact configured paths no longer over-match similarly named bodies, and aliased paths still fail through the retained count check. The RuntimeError wording changes, but no supplied caller or test relies on the previous text.
  • Implementation: Initialization still resolves exactly one rigid-body expression per configured member, converts each expression with path_expr_to_glob, and preserves configuration order alongside _body_names_list. Passing that ordered list directly to Newton’s ArticulationView removes the lossy merge, while count_per_world != num_bodies continues to reject short or excessive bindings.
  • Style consistency: The implementation follows adjacent structure and naming, removes dead code rather than retaining an unused helper, and keeps comments concise. The changelog fragment uses the package’s expected Fixed format, and the CONTRIBUTORS entry remains alphabetically placed.
  • Test quality: The changed test file adds test_collection_binds_only_configured_prims, with separate rows for the two distinct regressions: a similarly prefixed unconfigured sibling and configured members at different depths. It checks both total binding count and each named body’s observable pose, uses distinct positions to catch ordering or binding mistakes, and scopes the device through test_devices(DeviceScope.CUDA) without duplicating a backend-independent device matrix.

No blocking issues. No inline issue met the actionable-evidence threshold; the assessment above records the review feedback.

Automated review; human maintainers own approval decisions.

@ooctipus ooctipus self-assigned this Sep 30, 2026
@ooctipus ooctipus added the ci:run-docker Trigger the on-demand Docker and GPU CI workflow label Sep 30, 2026
@ooctipus
ooctipus merged commit 998bf88 into isaac-sim:develop Sep 30, 2026
54 of 55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ci:run-docker Trigger the on-demand Docker and GPU CI workflow isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Proposal] Fix Newton Object Collection Path Matching

2 participants