Skip to content

USD Parsing tools for MJC, PhysX and Custom Newton Attributes#710

Merged
eric-heiden merged 51 commits into
newton-physics:mainfrom
Milad-Rakhsha-NV:milad/schema-resolver
Oct 27, 2025
Merged

USD Parsing tools for MJC, PhysX and Custom Newton Attributes#710
eric-heiden merged 51 commits into
newton-physics:mainfrom
Milad-Rakhsha-NV:milad/schema-resolver

Conversation

@Milad-Rakhsha-NV

@Milad-Rakhsha-NV Milad-Rakhsha-NV commented Sep 3, 2025

Copy link
Copy Markdown
Member

Related to #709. There are a few things being considered here;

  1. Development of the newton schema/attributes; This is the newtonic way of authoring USD. They are attributes that are missing in UsdPhysics, but defined in other engines like physX or mujoco, and Newton can directly use them in model builder, e.g. joint armature or geoms contact margin, etc.

  2. When working with physX-based assets, we should still be able to remap the physX values to newton. The same applies to Mujoco. We should be able to make use of the mujoco attributes that are recognized by Newton.

  3. The user can define priority for parsing, i.e. define which engine attributes should be preferred.

  4. There are attributes that are specific to each engine/solver, and we may not be able to directly use them. They are usually prefixed with defined terms, like physxCollision, physxRigidBody, etc. For mujoco, we can reuse these later on when building the mjModel though. This PR makes these attributes accessible as part of the parsing results.

  5. The USD asset can define custom attributes that are expected to become part of the model/state/control attributes. Parsing of these special attributes are made possible in this PR. The custom attributes are expected to follow the newton:assignment:frequency:attribute_name where assignment can be model/state/control/contact and frequency defines whether the attribute_name is a per body/shape/articulation etc.

Description

Newton Migration Guide

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

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

Before your PR is "Ready for review"

  • 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

    • Custom attributes: declare per-model/state/control/contact attributes at BODY/SHAPE/JOINT/JOINT_DOF/JOINT_COORD/ARTICULATION frequencies; persisted through builds/merges and exposed on Model/State/Control.
    • Resolver-driven USD import: pluggable schema resolvers with solver-specific attribute extraction, per-prim custom attributes, per-DOF/per-axis joint states/limits (including D6), and propagation of physics_dt, max_solver_iterations, and solver_specific_attrs.
  • Public API

    • Added SchemaResolver family and resolver manager; exposed ModelAttributeFrequency and ModelAttributeAssignment enums; ModelBuilder/Model APIs extended to declare, accept, and materialize custom attributes and updated USD import signatures.
  • Tests & Assets

    • Added comprehensive resolver and custom-attribute test suites and new USD assets (ant_mixed, humanoid).

@coderabbitai

This comment was marked as spam.

Signed-off-by: Milad Rakhsha <mrakhsha@nvidia.com>
coderabbitai[bot]

This comment was marked as outdated.

Signed-off-by: Milad Rakhsha <mrakhsha@nvidia.com>
coderabbitai[bot]

This comment was marked as outdated.

@eric-heiden eric-heiden linked an issue Sep 3, 2025 that may be closed by this pull request
@adenzler-nvidia

Copy link
Copy Markdown
Member

lurking here - looking at how you convert from MJC attribute to newton I will probably poke you in the context of making sure that we get the inverse transform correct as well when setting up the MjWarp model.

Comment thread newton/_src/utils/schema_resolver.py Outdated
Comment thread newton/_src/utils/schema_resolver.py Outdated
Comment thread newton/_src/utils/schema_resolver.py Outdated
Comment thread newton/_src/utils/schema_resolver.py Outdated
Comment thread newton/_src/utils/schema_resolver.py Outdated
Comment thread newton/_src/utils/schema_resolver.py Outdated
Comment thread newton/_src/utils/schema_resolver.py Outdated
Comment thread newton/_src/utils/schema_resolver.py Outdated
Comment thread newton/_src/utils/schema_resolver.py Outdated
Comment thread newton/_src/utils/import_usd.py Outdated
@Milad-Rakhsha-NV

Copy link
Copy Markdown
Member Author

Thanks @andrewkaufman for the feedback. This PR still needs a bunch of cleaning and more importantly, changes in terms of how we consume the parsed data. I will incorporate your comments in the final version. I just created this draft PR to share some ideas with newotn/sim_usd folks in terms of how we can consume assets with potentially mixed schemas for various solvers;

@Milad-Rakhsha-NV Milad-Rakhsha-NV force-pushed the milad/schema-resolver branch 3 times, most recently from 96ffb7a to 6771b9e Compare September 5, 2025 02:28
…utes

Signed-off-by: Milad Rakhsha <mrakhsha@nvidia.com>
@Milad-Rakhsha-NV Milad-Rakhsha-NV force-pushed the milad/schema-resolver branch 2 times, most recently from 4e2d76d to 5a99b5f Compare September 5, 2025 02:53
Signed-off-by: Milad Rakhsha <mrakhsha@nvidia.com>
Signed-off-by: Milad Rakhsha <mrakhsha@nvidia.com>
coderabbitai[bot]

This comment was marked as outdated.

@Milad-Rakhsha-NV Milad-Rakhsha-NV force-pushed the milad/schema-resolver branch 5 times, most recently from aa5daae to 4a8d2e9 Compare September 6, 2025 02:42
Signed-off-by: Milad Rakhsha <mrakhsha@nvidia.com>
@Milad-Rakhsha-NV Milad-Rakhsha-NV force-pushed the milad/schema-resolver branch 2 times, most recently from c8f2812 to 582a4c4 Compare September 6, 2025 05:58
@coderabbitai coderabbitai Bot mentioned this pull request Dec 23, 2025
4 tasks
eric-heiden added a commit to eric-heiden/newton that referenced this pull request Jan 28, 2026
…-physics#710)

Signed-off-by: Milad Rakhsha <mrakhsha@nvidia.com>
Signed-off-by: Eric Heiden <eric-heiden@outlook.com>
Co-authored-by: Eric Heiden <eric-heiden@outlook.com>
mmacklin pushed a commit to mmacklin/newton that referenced this pull request Apr 7, 2026
…-physics#710)

Signed-off-by: Milad Rakhsha <mrakhsha@nvidia.com>
Signed-off-by: Eric Heiden <eric-heiden@outlook.com>
Co-authored-by: Eric Heiden <eric-heiden@outlook.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.

Implement mechanism to parse custom attributes

7 participants