Skip to content

Add PhysX support for DR Legs - #6667

Merged
kellyguo11 merged 2 commits into
isaac-sim:developfrom
AntoineRichard:antoiner/dr-legs-physx
Jul 23, 2026
Merged

kellyguo11 merged 2 commits into
isaac-sim:developfrom
AntoineRichard:antoiner/dr-legs-physx

Conversation

@AntoineRichard

@AntoineRichard AntoineRichard commented Jul 22, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Add a PhysX physics preset for the DR Legs hold-pose and walking environments.
  • Select the PhysX contact sensor and an assembled-joint reset profile for PhysX.
  • Bound driven and passive joint simulation velocities at 100 rad/s instead of inheriting the USD limit of about 17,000 rad/s.
  • Keep the PhysX-only 0.1 action scale because it provides the best velocity-tracking success, while preserving the existing Kamino solver and task presets.

Testing

  • ./isaaclab.sh -p -m pytest source/isaaclab_tasks/test/core/test_dr_legs_physics_presets.py -q (2 passed)
  • ./isaaclab.sh -f
  • Final configuration smoke: RSL-RL, IsaacContrib-DrLegs-Walk, presets=physx, 4096 environments, seed 42, 5 iterations; completed and reported 100 rad/s for all 30 joints.
  • Action-scale experiments at 4096 environments, seed 42, 300 iterations:
    • 0.3 without the limit: value loss became inf at iteration 1 and observations became NaN at iteration 3.
    • 0.3 with the 100 rad/s limit: completed without NaNs. Final-20 reward 326.16, episode length 494.20, success rate 0%, XY error 0.276 m/s, yaw error 0.829 rad/s.
    • 0.2 with the limit: completed without NaNs. Final-20 reward 356.03, episode length 496.36, success rate 51.95%, XY error 0.232 m/s, yaw error 0.423 rad/s; mean throughput 49.8k FPS.
    • 0.1 baseline: completed without NaNs. Final-20 reward 342.15, episode length 492.11, success rate 94.21%, XY error 0.237 m/s, yaw error 0.318 rad/s.
  • The solver clamp fixes numerical stability at larger scales. Scale 0.2 maximizes aggregate reward and slightly improves XY error, but scale 0.1 remains substantially better for yaw tracking and overall success.

@AntoineRichard
AntoineRichard requested a review from a team July 22, 2026 17:28
@github-actions github-actions Bot added the isaac-lab Related to Isaac Lab team label Jul 22, 2026
@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a PhysX physics backend preset to the DR Legs hold-pose and walking environments, alongside the existing Kamino/Newton configuration. The Kamino defaults are preserved unchanged; the new PhysX variant selects a reduced action scale (0.1), zero-range joint reset (for assembled coordinates), and the PhysX-native contact sensor.

  • hold_pose_env_cfg.py introduces DrLegsActionsCfg, DrLegsEventCfg, and DrLegsPhysicsCfg preset wrappers that branch on backend name, replacing the previous hard-coded ActionsCfg/EventCfg fields.
  • walk_env_cfg.py adds DrLegsContactSensorCfg, a PresetCfg that routes default/newton_kamino to NewtonContactSensorCfg and physx to PhysXContactSensorCfg.
  • Two unit tests guard the new PhysX walk-env assertions and the existing Kamino task distribution.

Confidence Score: 4/5

Safe to merge; the Kamino path is demonstrably unchanged and the PhysX preset has been smoke-tested at 4096 environments with measured FPS and reward metrics.

The logic is straightforward preset branching with no shared mutable state between backends. The two minor observations — missing type annotations on DrLegsContactSensorCfg and an incomplete assertion in the regression test — do not affect runtime correctness.

walk_env_cfg.py for the annotation inconsistency; test_dr_legs_physics_presets.py for the incomplete physics.physx assertion in the Kamino test.

Important Files Changed

Filename Overview
source/isaaclab_tasks/isaaclab_tasks/contrib/dr_legs/hold_pose_env_cfg.py Adds PhysxCfg to DrLegsPhysicsCfg, plus DrLegsActionsCfg (scale 0.1) and DrLegsEventCfg (zero-range joint reset) preset wrappers; updates DrLegsHoldPoseEnvCfg to use these wrappers while keeping Kamino defaults unchanged.
source/isaaclab_tasks/isaaclab_tasks/contrib/dr_legs/walk_env_cfg.py Adds DrLegsContactSensorCfg preset that selects Newton vs PhysX contact sensors by backend; fields lack type annotations unlike the other new preset classes in this PR.
source/isaaclab_tasks/test/core/test_dr_legs_physics_presets.py Two tests: PhysX walk-env preset assertion and Kamino regression guard; physics.physx type is never explicitly verified in the Kamino test.
source/isaaclab_tasks/changelog.d/antoiner-dr-legs-physx.minor.rst New changelog fragment describing the PhysX support addition — looks correct.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    CLI["presets=physx / presets=newton_kamino"]
    CLI --> RP["resolve_presets()"]

    RP --> PHYS["DrLegsPhysicsCfg"]
    RP --> ACT["DrLegsActionsCfg"]
    RP --> EVT["DrLegsEventCfg"]
    RP --> SENS["DrLegsContactSensorCfg\n(walk env only)"]

    PHYS -->|physx| PX_PHY["PhysxCfg()"]
    PHYS -->|newton_kamino / default| NK_PHY["NewtonCfg + KaminoSolverCfg"]

    ACT -->|physx| PX_ACT["scale=0.1"]
    ACT -->|newton_kamino / default| NK_ACT["scale=0.3"]

    EVT -->|physx| PX_EVT["position_range=(0,0)\nvelocity_range=(0,0)"]
    EVT -->|newton_kamino / default| NK_EVT["position_range=(-0.1,0.1)\nvelocity_range=(-0.05,0.05)"]

    SENS -->|physx| PX_SENS["PhysXContactSensorCfg"]
    SENS -->|newton_kamino / default| NK_SENS["NewtonContactSensorCfg"]
Loading

Reviews (1): Last reviewed commit: "Add PhysX support for DR Legs" | Re-trigger Greptile

Comment on lines 44 to 58
@configclass
class WalkSceneCfg(HoldPoseSceneCfg):
contact_forces = NewtonContactSensorCfg(
class DrLegsContactSensorCfg(PresetCfg):
"""Backend-specific foot contact sensor configuration."""

default = NewtonContactSensorCfg(
prim_path="{ENV_REGEX_NS}/Robot/foot_.*",
history_length=3,
track_air_time=True,
)
newton_kamino = default
physx = PhysXContactSensorCfg(
prim_path="{ENV_REGEX_NS}/Robot/foot_.*",
history_length=3,
track_air_time=True,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Missing type annotations on DrLegsContactSensorCfg fields

Unlike DrLegsActionsCfg and DrLegsEventCfg introduced in the same PR — which use explicit type annotations (default: ActionsCfg = ActionsCfg()) — the three fields on DrLegsContactSensorCfg carry no annotations. Since _preset_fields falls back to vars(cls) for unannotated attributes, this works at runtime, but the fields won't appear in __dataclass_fields__ and won't benefit from type checking. A base class annotation (e.g., ContactSensorCfg from a shared module, or simply object) would make the pattern consistent with the rest of this PR.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +34 to +44
def test_dr_legs_kamino_presets_remain_unchanged() -> None:
"""PhysX support must not change the existing Kamino task distribution."""
physics = DrLegsPhysicsCfg()
env_cfg = resolve_presets(DrLegsHoldPoseEnvCfg(), selected=("newton_kamino",))

assert isinstance(physics.default, NewtonCfg)
assert isinstance(physics.newton_kamino.solver_cfg, KaminoSolverCfg)
assert env_cfg.events.reset_base.params["pose_range"]["x"] == (-0.05, 0.05)
assert env_cfg.events.reset_robot_joints.params["position_range"] == (-0.1, 0.1)
assert env_cfg.events.reset_robot_joints.params["velocity_range"] == (-0.05, 0.05)
assert env_cfg.actions.joint_pos.scale == 0.3

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 DrLegsPhysicsCfg.physx not asserted in the Kamino regression test

test_dr_legs_kamino_presets_remain_unchanged instantiates DrLegsPhysicsCfg and asserts on physics.default and physics.newton_kamino, but never checks physics.physx. Adding assert isinstance(physics.physx, PhysxCfg) here (the import is already present) would complete the round-trip coverage and guard against accidental drift of the new preset's type in the same test that validates the existing ones.

@github-actions github-actions Bot added the asset New asset feature or request label Jul 22, 2026
@kellyguo11
kellyguo11 merged commit 275ba25 into isaac-sim:develop Jul 23, 2026
40 of 41 checks passed
matthewtrepte pushed a commit to matthewtrepte/IsaacLab that referenced this pull request Aug 4, 2026
## Summary

- Add a PhysX physics preset for the DR Legs hold-pose and walking
environments.
- Select the PhysX contact sensor and an assembled-joint reset profile
for PhysX.
- Bound driven and passive joint simulation velocities at 100 rad/s
instead of inheriting the USD limit of about 17,000 rad/s.
- Keep the PhysX-only 0.1 action scale because it provides the best
velocity-tracking success, while preserving the existing Kamino solver
and task presets.

## Testing

- `./isaaclab.sh -p -m pytest
source/isaaclab_tasks/test/core/test_dr_legs_physics_presets.py -q` (`2
passed`)
- `./isaaclab.sh -f`
- Final configuration smoke: RSL-RL, `IsaacContrib-DrLegs-Walk`,
`presets=physx`, 4096 environments, seed 42, 5 iterations; completed and
reported 100 rad/s for all 30 joints.
- Action-scale experiments at 4096 environments, seed 42, 300
iterations:
- 0.3 without the limit: value loss became `inf` at iteration 1 and
observations became NaN at iteration 3.
- 0.3 with the 100 rad/s limit: completed without NaNs. Final-20 reward
326.16, episode length 494.20, success rate 0%, XY error 0.276 m/s, yaw
error 0.829 rad/s.
- 0.2 with the limit: completed without NaNs. Final-20 reward 356.03,
episode length 496.36, success rate 51.95%, XY error 0.232 m/s, yaw
error 0.423 rad/s; mean throughput 49.8k FPS.
- 0.1 baseline: completed without NaNs. Final-20 reward 342.15, episode
length 492.11, success rate 94.21%, XY error 0.237 m/s, yaw error 0.318
rad/s.
- The solver clamp fixes numerical stability at larger scales. Scale 0.2
maximizes aggregate reward and slightly improves XY error, but scale 0.1
remains substantially better for yaw tracking and overall success.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

asset New asset feature or request isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants