Fix randomize_rigid_body_material crash with Newton backend#5063
Open
ax-anoop wants to merge 2 commits intoisaac-sim:developfrom
Open
Fix randomize_rigid_body_material crash with Newton backend#5063ax-anoop wants to merge 2 commits intoisaac-sim:developfrom
ax-anoop wants to merge 2 commits intoisaac-sim:developfrom
Conversation
The `randomize_rigid_body_material` event term crashes when using the Newton physics backend because it unconditionally accesses PhysX-specific APIs (`root_view.link_paths`, `_physics_sim_view.create_rigid_body_view`, `root_view.max_shapes`) that do not exist on Newton's `ArticulationView`. Newton's underlying engine (MuJoCo-Warp) does not currently expose runtime material property APIs (`get_material_properties`, `set_material_properties`), so full material randomization is not yet possible on the Newton backend. This change: - Detects backend support by checking for `root_view.max_shapes` - Gracefully skips with a warning when the backend lacks support - Also uses `asset.num_shapes_per_body` when available (Newton provides this property), avoiding the PhysX-specific `link_paths` workaround - Preserves existing PhysX behavior unchanged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
randomize_rigid_body_materialcrashes withAttributeError: 'ArticulationView' object has no attribute 'link_paths'when using the Newton physics backend (presets=newton).The event term's
__init__unconditionally uses PhysX-specific APIs to compute the number of collision shapes per body:Newton's
ArticulationViewdoes not exposelink_paths,max_shapes,get_material_properties(), orset_material_properties().Note: The underlying MuJoCo-Warp engine does support runtime friction modification via
model.geom_friction— this is a well-established MuJoCo capability used in production RL pipelines. The gap is in IsaacLab's NewtonArticulationViewabstraction, which does not yet map these MuJoCo fields to theget/set_material_propertiesAPI that the event system expects.Changes
hasattr(self.asset.root_view, "max_shapes")before accessing material APIslogger.warningwhen the backend lacks supportasset.num_shapes_per_bodydirectly (as Newton does), use it instead of the PhysX-specificlink_pathsworkaround__call__to return early if the backend doesn't support material randomizationReproduction
Crashes with:
After this fix, Newton training runs successfully with the material randomization event skipped and a warning logged.
Longer-term
Full material randomization on Newton requires exposing MuJoCo-Warp's
model.geom_friction(and related geom properties) through the NewtonArticulationView'sget_material_properties()/set_material_properties()API. MuJoCo-Warp fully supports runtime per-environment friction modification — the gap is in the IsaacLab abstraction layer, not the physics engine.Test plan
presets=newton)randomize_rigid_body_material🤖 Generated with Claude Code