Skip to content

Add num_shapes_per_body to Newton RigidObject#7

Closed
vidurv-nvidia wants to merge 10 commits into
ooctipus:feature/event_mdp_parityfrom
vidurv-nvidia:vidur/fix-rigid-object-num-shapes
Closed

Add num_shapes_per_body to Newton RigidObject#7
vidurv-nvidia wants to merge 10 commits into
ooctipus:feature/event_mdp_parityfrom
vidurv-nvidia:vidur/fix-rigid-object-num-shapes

Conversation

@vidurv-nvidia
Copy link
Copy Markdown

Summary

The Newton randomize_rigid_body_material implementation calls asset.num_shapes_per_body on both Articulation and RigidObject. The property was added to Articulation but is missing from RigidObject, causing AttributeError when randomizing friction on rigid objects (e.g. a power supply object in a manipulation task).

This adds the same cached num_shapes_per_body property to Newton's RigidObject, using self._root_view.body_shapes (same approach as the Articulation implementation).

Test

Without this fix:

File "isaaclab/envs/mdp/events.py", line 288, in __init__
    total_shapes = sum(asset.num_shapes_per_body)
AttributeError: 'RigidObject' object has no attribute 'num_shapes_per_body'

With this fix: randomize_rigid_body_material works on both Articulation and RigidObject assets on the Newton backend.

ooctipus and others added 10 commits April 9, 2026 21:11
- Revert all friction/restitution/material setter additions from Newton
  and PhysX asset classes (9 files). Material property operations stay
  at the view level.
- Split randomize_rigid_body_material into backend-specific classes:
  PhysX uses bucket-based 3-tuple materials via root_view; Newton
  samples friction/restitution continuously per shape via view-level
  attribute bindings.
- Convert randomize_rigid_body_com from function to ManagerTermBase
  class with cached defaults for repeatable randomization.
- Split randomize_rigid_body_collider_offsets into backend-specific
  classes: PhysX uses rest/contact offsets; Newton maps to
  shape_margin/shape_gap.
- Add BaseRigidObjectCollection support to randomize_rigid_body_inertia.
- Fix _physics_sim_view bug (was incorrectly using root_view).
- Restore shape-count validation in PhysX material init.
- Rewrite all tests to use view-level APIs instead of asset setters.
- Un-skip Newton rigid object material tests; skip friction/restitution
  behavior tests that are incompatible with MuJoCo physics model.
- Remove stale Newton/PhysX changelog entries, rewrite isaaclab entry.
- Fix randomize_rigid_body_com to pass partial data (env_ids subset)
  to set_coms_index, matching the pattern used by mass/inertia terms.
- Remove dead _default_friction/_default_restitution writes in Newton
  material implementation (values were written but never read back).
- Guard Newton collider offset notification to only fire when params
  are actually provided.
- Fix changelog Sphinx roles for converted function-to-class items.
The Newton randomize_rigid_body_material impl calls
asset.num_shapes_per_body on both Articulation and RigidObject.
The property existed on Articulation but was missing from RigidObject,
causing AttributeError when randomizing friction on rigid objects.
@github-actions github-actions Bot added bug Something isn't working isaac-lab labels Apr 10, 2026
@AntoineRichard AntoineRichard force-pushed the feature/event_mdp_parity branch from 9cf3321 to ba77aa5 Compare April 13, 2026 11:02
@ooctipus ooctipus deleted the branch ooctipus:feature/event_mdp_parity May 30, 2026 23:49
@ooctipus ooctipus closed this May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working isaac-lab

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants