Skip to content

Fix Newton cfgs cancelling inherited PhysX field routing - #6504

Closed
vidurv-nvidia wants to merge 1 commit into
isaac-sim:developfrom
vidurv-nvidia:vidurv/schema-frag-exception-shadowing
Closed

vidurv-nvidia wants to merge 1 commit into
isaac-sim:developfrom
vidurv-nvidia:vidurv/schema-frag-exception-shadowing

Conversation

@vidurv-nvidia

Copy link
Copy Markdown
Contributor

Description

Seven Newton/MuJoCo schema cfg classes redeclare _usd_field_exceptions: ClassVar[dict] = {}. Python attribute lookup stops at the first class in the MRO that defines the attribute — even when the value is empty — so the redeclaration shadows the base classes' routing table for PhysX-consumed fields those classes inherit (disable_gravity, contact_offset, rest_offset, max_joint_velocity).

Observed behavior on develop (verified by executing the writer per class/field):

Cfg Field set Actual Intended
NewtonRigidBodyPropertiesCfg, MujocoRigidBodyPropertiesCfg disable_gravity bare physics:disableGravity (no consumer) physxRigidBody:disableGravity
NewtonCollisionPropertiesCfg + Mesh/SDF subclasses contact_offset/rest_offset bare physics:* (no consumer) physxCollision:*
NewtonJointDrivePropertiesCfg, MujocoJointDrivePropertiesCfg max_joint_velocity raises ValueError physxJoint:maxJointVelocity

That the shadowing is accidental is shown by NewtonArticulationRootPropertiesCfg, which does not redeclare the attribute and routes its inherited articulation_enabled to physxArticulation:* correctly — one sibling inherited the pattern right, six copied boilerplate that cancels it.

Fix

Remove the empty redeclarations from the seven classes so the base routing applies, with a comment at each site explaining why the attribute must stay inherited. No writer changes.

Tests

Six regression tests drive each affected field through the public writers (define_rigid_body_properties, define_collision_properties, modify_joint_drive_properties) and assert the PhysX-namespaced attribute is authored (with the rad/s→deg conversion for the joint velocity) and no bare physics:* attribute appears. All fail before the fix (two with the ValueError), pass after. test_newton_schemas.py 25/26 and core test_schemas.py 40/40 locally — the one unrelated failure (test_newton_material_fragment_authors_all_six_newton_attrs) also fails on clean develop in this environment and appears to be resolver-key drift from the recent Newton bump; flagged separately.

Type of change

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

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have added a changelog fragment under source/<pkg>/changelog.d/
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

Seven Newton and MuJoCo schema cfg classes redeclared
_usd_field_exceptions as an empty dict. Attribute lookup stops at the
first class that defines it, so the redeclaration cancelled the base
classes' routing of inherited PhysX-consumed fields. Setting
disable_gravity, contact_offset, or rest_offset on those cfgs authored
a bare physics attribute that no backend reads, and setting
max_joint_velocity on the joint-drive cfgs made the writer raise
because the declaring base class carries no namespace of its own.

Remove the empty redeclarations so the base routing applies, matching
the articulation-root cfg which already inherited it correctly, and
leave a comment at each site explaining why the attribute must stay
inherited. The regression tests set each affected field through the
public writers and assert the PhysX-namespaced attribute is authored.
@github-actions github-actions Bot added the isaac-lab Related to Isaac Lab team label Jul 14, 2026
@vidurv-nvidia

Copy link
Copy Markdown
Contributor Author

Superseded by #7832, which re-derives this fix against current develop — this branch predates substantial changes to schemas_cfg.py and no longer applies cleanly.

Confirmed the bug still reproduces before closing: the empty _usd_field_exceptions redeclarations shadow the base routing table, so disable_gravity authors physics:disableGravity (which no backend reads) instead of physxRigidBody:disableGravity. #7832 fixes the 7 classes that shadow a non-empty base, with six regression tests verified to fail without the fix.

ooctipus added a commit that referenced this pull request Sep 20, 2026
# Description

Nine Newton schema config classes redeclare `_usd_field_exceptions:
ClassVar[dict] = {}`. The writer reads that table with a plain
`getattr`, so normal MRO lookup stops at the subclass's empty dict and
the inherited routing table is never consulted. The affected fields then
fall through to per-declaring-class routing and land in the *base*
namespace.

The user-visible result is a silently inert attribute. For example, a
Newton rigid-body cfg with `disable_gravity=True` authors:

```
physics:disableGravity        = True     <- no backend reads this
physxRigidBody:disableGravity = <unset>  <- what should have been written
```

Gravity stays on. Same shape for `contact_offset` / `rest_offset` on the
collision cfgs. For `max_joint_velocity` it is louder — the writer
raises:

```
ValueError: JointDriveBaseCfg declares fields ['maxJointVelocity'] but does not define
'_usd_namespace'. Add '_usd_namespace' to the class metadata or route the fields via
'_usd_field_exceptions'.
```

Seven of the nine shadow a non-empty base table and are fixed here:
`NewtonRigidBodyPropertiesCfg`, `MujocoRigidBodyPropertiesCfg`,
`NewtonCollisionPropertiesCfg`, `NewtonMeshCollisionPropertiesCfg`,
`NewtonSDFCollisionPropertiesCfg`, `NewtonJointDrivePropertiesCfg`,
`MujocoJointDrivePropertiesCfg`.

The remaining two — `NewtonDeformableBodyPropertiesCfg` and
`NewtonMaterialPropertiesCfg` — are left alone deliberately: their bases
carry no routing table, so the empty redeclaration is currently inert.
It is the same latent footgun and worth a follow-up, but changing it
here would be a behavior change with no bug to point at.

Supersedes #6504, whose branch predates substantial changes to this
file.

## Type of change

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

## Testing

Routing coverage includes all seven affected config classes, including
the multiply inherited mesh config and angular joint-velocity
conversion. Four checks extend existing schema tests; one Newton
rigid-body test and a parametrized joint-drive test cover the remaining
classes.

- `test_newton_schemas.py`: **16 passed**.
- Restoring the seven empty routing dictionaries in memory makes **all
seven routing regression cases fail**; all seven pass with the fix.
- `uv run isaaclab -f`: passed.

Local validation used Isaac Sim 6.0.1.0, Newton 1.6.0rc1, and PyTorch
2.12.0; this does not replace CI against the pinned dependencies.

## Checklist

- [x] I have read and understood the contribution guidelines
- [x] I have run the `pre-commit` checks with `./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] I have added a changelog fragment under
`source/<pkg>/changelog.d/` for every touched package
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

---------

Co-authored-by: ooctipus <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant