Skip to content

Fix USD visual shape transform parsing#499

Merged
eric-heiden merged 4 commits into
newton-physics:mainfrom
eric-heiden:fix-usd-visual-shape-transform
Aug 3, 2025
Merged

Fix USD visual shape transform parsing#499
eric-heiden merged 4 commits into
newton-physics:mainfrom
eric-heiden:fix-usd-visual-shape-transform

Conversation

@eric-heiden

@eric-heiden eric-heiden commented Aug 3, 2025

Copy link
Copy Markdown
Member

Description

Rotations of visual shapes need to be transposed to match their collision shapes

  • Renamed cartPole.usda -> cartpole.usda
  • Add unit tests to compare visual and collision shapes for humanoid.usda

Newton Migration Guide

Please ensure the migration guide for warp.sim users is up-to-date with the changes made in this MR.

  • The migration guide in docs/migration.rst is up-to date

Before your PR is "Ready for review"

  • All commits are signed-off to indicate that your contribution adheres to the Developer Certificate of Origin requirements
  • Necessary tests have been added and new examples are tested (see newton/tests/test_examples.py)
  • Documentation is up-to-date
  • Code passes formatting and linting checks with pre-commit run -a

Summary by CodeRabbit

  • New Features

    • Added a new test to verify consistency between visual and collision shapes in USD models, ensuring they match in type, source, and transformation.
  • Bug Fixes

    • Improved handling of ignored paths when importing USD assets, preventing unwanted visual shapes from being loaded.
  • Refactor

    • Changed the default behavior for rotation handling when importing USD files, which may affect how model orientations are processed.

Signed-off-by: Eric Heiden <eheiden@nvidia.com>
Signed-off-by: Eric Heiden <eheiden@nvidia.com>
Signed-off-by: Eric Heiden <eheiden@nvidia.com>
@eric-heiden eric-heiden requested a review from shi-eric August 3, 2025 07:31
@coderabbitai

coderabbitai Bot commented Aug 3, 2025

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

A new unit test was added to validate the correspondence between visual and collision shapes in USD-imported models. The USD import utility was updated to invert rotations by default and to skip loading visual shapes from paths matching specified ignore patterns.

Changes

Cohort / File(s) Change Summary
Test for visual/collision shape correspondence
newton/tests/test_import_usd.py
Added a unit test (test_visual_match_collision_shapes) that verifies visual and collision shapes from a USD asset match in type, source, transform, scale, and collision flag, using the ModelBuilder and a sample USD file.
USD import utility logic
newton/utils/import_usd.py
Changed the default value of invert_rotations in parse_usd to True; updated logic to skip loading visual shapes whose prim paths match any pattern in the ignore_paths list.

Sequence Diagram(s)

sequenceDiagram
    participant Test as TestImportUsd
    participant Builder as ModelBuilder
    participant Importer as parse_usd

    Test->>Builder: create()
    Test->>Importer: parse_usd("humanoid.usda", ...)
    Importer-->>Builder: populate shapes and bodies
    Test->>Builder: get shapes and bodies
    Test->>Test: filter visual and collision shapes
    loop For each visual shape
        Test->>Test: find corresponding collision shape
        Test->>Test: compare type, source, transform, scale, flags
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Load visual-only shapes from USD #473: Modifies parse_usd to load visual-only shapes from non-physics prims, directly involving parse_usd and visual shape handling in import_usd.py, which is also addressed in this PR.

Suggested reviewers

  • Milad-Rakhsha-NV

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ed05bc8 and c90480c.

📒 Files selected for processing (2)
  • newton/tests/test_import_usd.py (2 hunks)
  • newton/utils/import_usd.py (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: in warp benchmarks, explicit wp.init() calls are not needed in most circumstances since the first wa...
Learnt from: shi-eric
PR: newton-physics/newton#461
File: asv/benchmarks/envs/example_humanoid.py:40-41
Timestamp: 2025-07-23T14:36:42.182Z
Learning: In Warp benchmarks, explicit wp.init() calls are not needed in most circumstances since the first Warp API call that requires initialization will automatically call wp.init(). Explicit wp.init() in setup() methods is helpful when the ASV benchmark is measuring a Warp API call, as wp.init() has non-trivial overhead that should be excluded from the benchmark timing.

Applied to files:

  • newton/tests/test_import_usd.py
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Run GPU Benchmarks (Pull Request)
  • GitHub Check: Run GPU Unit Tests on AWS EC2 (Pull Request)
  • GitHub Check: run-newton-tests / newton-unittests (ubuntu-latest)
  • GitHub Check: run-newton-tests / newton-unittests (windows-latest)
🔇 Additional comments (4)
newton/utils/import_usd.py (2)

41-41: LGTM: Default rotation inversion aligns visual with collision shapes.

Changing the default value of invert_rotations from False to True ensures that rotations of visual shapes are properly transposed to match their corresponding collision shapes, which addresses the core issue described in the PR objectives.


317-318: LGTM: Path filtering prevents loading unwanted visual shapes.

The addition of path filtering logic using regex matching allows selective loading of visual shapes, which complements the rotation fix by providing control over which visual shapes are processed.

newton/tests/test_import_usd.py (2)

23-23: LGTM: Import addition supports new test.

Adding the newton.examples import enables access to the test asset used in the new unit test.


303-329: Excellent test coverage for visual/collision shape alignment.

This comprehensive test validates the core functionality addressed by the PR:

  1. Proper asset loading: Uses the humanoid.usda asset to test real-world scenarios
  2. Shape correspondence: Verifies that visual and collision shapes have matching types, sources, transforms, and scales
  3. Transform validation: Uses appropriate tolerance (1e-5) for numerical comparisons
  4. Collision flag verification: Ensures visual shapes are non-colliding while collision shapes are colliding

The test effectively validates that the rotation inversion fix ensures visual shapes properly align with their collision counterparts.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@eric-heiden eric-heiden merged commit d13353f into newton-physics:main Aug 3, 2025
14 of 15 checks passed
This was referenced Aug 18, 2025
eric-heiden added a commit to eric-heiden/newton that referenced this pull request Jan 28, 2026
Signed-off-by: Eric Heiden <eheiden@nvidia.com>
vidurv-nvidia pushed a commit to vidurv-nvidia/newton that referenced this pull request Mar 6, 2026
# Description

Updates supported systems for teleop requirements in documentation.


## Type of change

- This change requires a documentation update

## Checklist

- [ ] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [ ] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

<!--
As you go through the checklist above, you can mark something as done by
putting an x character in it

For example,
- [x] I have done this task
- [ ] I have not done this task
-->
mmacklin pushed a commit to mmacklin/newton that referenced this pull request Apr 7, 2026
Signed-off-by: Eric Heiden <eheiden@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants