Skip to content

Support Multi-Back for Demo Scripts (Part 2) and Unify Code Structure - #6140

Merged
ooctipus merged 23 commits into
isaac-sim:developfrom
YizeWang:yizew/support-multi-backends-part-2
Jun 15, 2026
Merged

ooctipus merged 23 commits into
isaac-sim:developfrom
YizeWang:yizew/support-multi-backends-part-2

Conversation

@YizeWang

@YizeWang YizeWang commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR updates several demo scripts to support multi-backends and unify the code structure of all demo scripts.

No new required dependencies.

Type of change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Documentation update

Screenshots

arl_robot_1_3x_compressed deformables_3x_compressed_half_1p5x markers_3x_compressed procedural_terrain

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh -f
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the changelog
  • I have added my name to CONTRIBUTORS.md or my name already exists there

@github-actions github-actions Bot added the isaac-lab Related to Isaac Lab team label Jun 11, 2026
@greptile-apps

greptile-apps Bot commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR unifies the structure of demo scripts to use launch_simulation / add_launcher_args instead of the older AppLauncher pattern, and extends multi_asset.py and haply_teleoperation.py with Newton (MJWarp) physics backend support.

  • Demo scripts refactored: All 14 scripts are unified to use launch_simulation, TYPE_CHECKING guards for heavy imports, and while sim.is_headless_or_exist_active_visualizer() loop pattern; stale inline comments are removed.
  • multi_asset.py extended: Adds --physics newton_mjwarp support, guards against None color spec, updates object collection prim paths under an ObjectCollection/ sub-path, and replaces ConeCfg with CylinderCfg.
  • Library changes: VisualizationMarkersCfg gains a class_type field; terrains/utils.py changes the default color map from \"turbo\" to \"inferno\".

Confidence Score: 4/5

The PR is mostly safe to merge; the structural cleanup across all demo scripts is straightforward, with one robot reset block in multi_asset.py that dropped .clone() inconsistently and may silently corrupt default tensor buffers on repeated resets.

The structural unification is clean and consistent across all 14 scripts. The .clone() removal for robot joint/velocity tensors in multi_asset.py is a concrete defect that could produce incorrect simulation state on reset without any error message. Everything else is cosmetic.

scripts/demos/multi_asset.py — specifically the robot reset block where .clone() was dropped for default_root_vel and default_joint_pos/vel tensors.

Important Files Changed

Filename Overview
scripts/demos/multi_asset.py Adds newton_mjwarp support, null-checks color_spec, fixes prim paths; contains unusual double-parenthesis syntax and inconsistent .clone() usage compared to rigid_object reset
source/isaaclab/isaaclab/terrains/utils.py Default colormap changed from turbo to inferno but the module docstring still refers to the Turbo colormap
source/isaaclab/isaaclab/markers/visualization_markers_cfg.py Adds class_type field and TYPE_CHECKING guard; enables the cfg.class_type(cfg) factory pattern
scripts/demos/procedural_terrain.py Migrated to launch_simulation; --physics arg added with only physx as valid choice (effectively dead argument)
scripts/demos/haply_teleoperation.py Migrated to launch_simulation; type annotation on robot fixed from Articulation to ArticulationCfg
scripts/demos/bin_packing.py isaaclab_newton import repositioned with isort:skip; return type annotation removed from main()
scripts/demos/arms.py Minor docstring formatting and typo fixes only
scripts/demos/bipeds.py Docstring formatting unified; no functional change
scripts/demos/hands.py Docstring and typo fix; no functional change

Comments Outside Diff (2)

  1. scripts/demos/multi_asset.py, line 118-122 (link)

    P2 Redundant parentheses around sim_utils.CylinderCfg — (ClassName)(args) is syntactically valid Python but calls the class in an unusual two-step way. It's equivalent to plain sim_utils.CylinderCfg(...) and is likely a typo left over from removing ConeCfg.

    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!

  2. source/isaaclab/isaaclab/terrains/utils.py, line 22-24 (link)

    P2 The default colormap was changed from "turbo" to "inferno", but the function's docstring still says "using the Turbo colormap", which is now incorrect.

    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!

Reviews (1): Last reviewed commit: "Clean Up multi_asset.py" | Re-trigger Greptile

Comment on lines +264 to +268
root_vel = robot.data.default_root_vel.torch
robot.write_root_velocity_to_sim_index(root_velocity=root_vel)
# -- joint state
joint_pos, joint_vel = (
robot.data.default_joint_pos.torch.clone(),
robot.data.default_joint_vel.torch.clone(),
)
joint_pos = robot.data.default_joint_pos.torch
joint_vel = robot.data.default_joint_vel.torch

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.

P1 .clone() is omitted for root_vel, joint_pos, and joint_vel when resetting the robot, but the immediately preceding root_pose reset still uses .clone(). The same applies to rigid_object reset at line 251 (.clone() is preserved there). If write_*_to_sim_index modifies the tensor in-place, skipping .clone() would corrupt the default_root_vel / default_joint_* buffers and produce wrong values on subsequent resets.

Suggested change
root_vel = robot.data.default_root_vel.torch
robot.write_root_velocity_to_sim_index(root_velocity=root_vel)
# -- joint state
joint_pos, joint_vel = (
robot.data.default_joint_pos.torch.clone(),
robot.data.default_joint_vel.torch.clone(),
)
joint_pos = robot.data.default_joint_pos.torch
joint_vel = robot.data.default_joint_vel.torch
root_vel = robot.data.default_root_vel.torch.clone()
robot.write_root_velocity_to_sim_index(root_velocity=root_vel)
# -- joint state
joint_pos = robot.data.default_joint_pos.torch.clone()
joint_vel = robot.data.default_joint_vel.torch.clone()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

root_vel joint_pos joint_vel are not modified. No need to clone these variables. root_pose is cloned because of root_pose[:, :3] += scene.env_origins.

Comment thread scripts/demos/procedural_terrain.py Resolved
description="View ARL Robot 1 with Lee Position Controller.",
conflict_handler="resolve",
)
parser.add_argument("--physics", default="physx", choices=["physx"], help="Physics backend.")

@YizeWang YizeWang Jun 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The Newton backend is not supported because the Multirotor class is directly tied to the physx backend. Filed Proposal#6141: Add Newton Backend Support for Multirotor Asset.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this is Ok for now. We can look into drones later.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks.

)
parser.add_argument("--physics", default="physx", choices=["physx", "newton_mjwarp"], help="Physics backend.")
# Newton visualizer not supported for deformables
parser.add_argument("--visualizer", default="kit", choices=["kit"], help="Visualizer backend.")

@YizeWang YizeWang Jun 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The Newton visualizer is not supported because the Newton shadow-model fails to import PhysX-authored deformable USD. Filed Proposal#6142: Support Kit-less Deformable USD.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@mmichelis an you take a look? :)

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.

Answered in the proposal! Thanks for bringing this up, this is something we aim to have in the future! So far only newton backend can be visualized in newton, but ideally we can also visualize physx backend in newton.

sim_device=args_cli.device,
limit_force=2.0,
)
haply_device = haply_cfg.class_type(cfg=haply_cfg)

@YizeWang YizeWang Jun 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This script has NOT been validated, because HaplyDevice requires peripheral devices of Inverse3 and VerseGrip, which are not available on my device. If needed, I can coordinate with Nic Ma to perform a validation.

Comment thread scripts/demos/markers.py
description="This script demonstrates different types of markers.",
conflict_handler="resolve",
)
parser.add_argument("--physics", default="physx", choices=["physx"], help="Physics backend.")

@YizeWang YizeWang Jun 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment thread scripts/demos/multi_asset.py Outdated

def randomize_shape_color(prim_path_expr: str):
"""Randomize the color of the geometry."""
from pxr import Gf, Sdf

@YizeWang YizeWang Jun 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Discussion with @ooctipus in progress. We want to avoid all local imports.

Signed-off-by: Yize Wang <[email protected]>
Comment on lines 49 to 53
import carb
import omni
from omni.kit.viewport.utility import get_viewport_from_window_name
from omni.kit.viewport.utility.camera_state import ViewportCameraState
from pxr import Gf, Sdf

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In discussion with @ooctipus on how to avoid local imports for carb omni pxr.

@YizeWang YizeWang mentioned this pull request Jun 11, 2026
1 of 4 tasks
# append AppLauncher cli args
AppLauncher.add_app_launcher_args(parser)
# demos should open Kit visualizer by default
parser.add_argument("--physics", default="physx", choices=["physx"], help="Physics backend.")

@YizeWang YizeWang Jun 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The Newton physics backend is not support because MJWarp requires at least 1 joint while this scene only contains a ground. Filed Proposal#6144: Support Newton MJWarp for No-joint Scenes.

Comment on lines +297 to +300
if args_cli.physics == "newton_mjwarp":
# Newton/MJWarp requires a uniform layout, not supporting different setups across environments.
scene_cfg.object.spawn.assets_cfg = scene_cfg.object.spawn.assets_cfg[1:2]
scene_cfg.robot.spawn.usd_path = scene_cfg.robot.spawn.usd_path[0]

@YizeWang YizeWang Jun 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The newton backend does not support heterogeneous spawning. Filed Proposal#6162: Support Mixed Spawns with Newton-MJWarp.

# Get the color for each vertex based on the height
color_map = kwargs.pop("color_map", "turbo")
# Valid options are ["viridis", "inferno", "plasma", "magma"]
color_map = kwargs.pop("color_map", "inferno")

@YizeWang YizeWang Jun 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Rationale: "turbo" is not available anymore.

Comment thread scripts/demos/multi_asset.py Outdated
spawn=sim_utils.MultiAssetSpawnerCfg(
assets_cfg=[
sim_utils.ConeCfg(
(sim_utils.CylinderCfg)(

@YizeWang YizeWang Jun 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Rational: I replaced ConeCfg with CylinderCfg because the former is not supported in Newton.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe it should be. Can you open a discussion with Newton?

Signed-off-by: Yize Wang <[email protected]>
@@ -111,7 +115,7 @@ class MultiObjectSceneCfg(InteractiveSceneCfg):
prim_path="/World/envs/env_.*/Object",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@AntoineRichard The newton backend requires this to be "/World/envs/env_.*/ObjectCollection/Object_A".

@YizeWang YizeWang Jun 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[Update] @AntoineRichard is working on cleaning up this. Filed Proposal#6147: Fix Newton Object Collection Path Matching.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[Update] The discussion is in https://nvidia.slack.com/archives/C0AV4B102HG/p1781501068492329. We have not reached an agreement with colleagues from the newton backend.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[Update] @AntoineRichard will draft a PR on the newton side.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@AntoineRichard AntoineRichard left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

A high level comment, I'm wondering if we could add tests to validate that most the examples are working as expected. This would be great to maintain things in the future.

Comment thread scripts/demos/multi_asset.py Outdated
spawn=sim_utils.MultiAssetSpawnerCfg(
assets_cfg=[
sim_utils.ConeCfg(
(sim_utils.CylinderCfg)(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe it should be. Can you open a discussion with Newton?

description="View ARL Robot 1 with Lee Position Controller.",
conflict_handler="resolve",
)
parser.add_argument("--physics", default="physx", choices=["physx"], help="Physics backend.")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this is Ok for now. We can look into drones later.

)
parser.add_argument("--physics", default="physx", choices=["physx", "newton_mjwarp"], help="Physics backend.")
# Newton visualizer not supported for deformables
parser.add_argument("--visualizer", default="kit", choices=["kit"], help="Visualizer backend.")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@mmichelis an you take a look? :)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It also looks like the deformable look a lot better with newton? At least in the video @YizeWang shared

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.

it might make more sense to have an error thrown specifically for backend physx and visualizer newton, since the current setup excludes backend newton and visualizer newton.

@YizeWang Would it be possible to run the two at a fixed seed for comparison? Then the same objects are spawned and we can compare them more fairly, I think Newton is still struggling a bit with friction and collision, which by default isn't great so needs to be tuned. But I would say this is down to default parameter choice.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, we can.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Jun 15, 2026
@ooctipus
ooctipus merged commit 063e192 into isaac-sim:develop Jun 15, 2026
37 checks passed
matthewtrepte pushed a commit to matthewtrepte/IsaacLab that referenced this pull request Aug 4, 2026
…isaac-sim#6140)

# Description

This PR updates several demo scripts to support multi-backends and unify
the code structure of all demo scripts.

No new required dependencies.

## Type of change

- New feature (non-breaking change which adds functionality)
- Bug fix (non-breaking change which fixes an issue)
- Documentation update

## Screenshots

<img width="3290" height="1016" alt="arl_robot_1_3x_compressed"
src="https://github.com/user-attachments/assets/5681a5d9-de29-4e8a-878f-a203b81590f8"
/>

<img width="1440" height="450" alt="deformables_3x_compressed_half_1p5x"
src="https://github.com/user-attachments/assets/ad0d2490-143a-43aa-bb2d-a1afcbd8fdfe"
/>

<img width="1440" height="900" alt="markers_3x_compressed"
src="https://github.com/user-attachments/assets/37b26c85-e050-4483-851d-51276f498a0e"
/>

<img width="1866" height="1170" alt="procedural_terrain"
src="https://github.com/user-attachments/assets/f8190bc0-7360-4266-85fc-64d84758061d"
/>

## Checklist

- [ ] I have read and understood the contribution guidelines
- [x] I have run the pre-commit checks with ./isaaclab.sh -f
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have updated the changelog
- [x] I have added my name to CONTRIBUTORS.md or my name already exists
there

---------

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

Labels

documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants