Skip to content

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

Open
YizeWang wants to merge 18 commits into
isaac-sim:developfrom
YizeWang:yizew/support-multi-backends-part-2
Open

Support Multi-Back for Demo Scripts (Part 2) and Unify Code Structure#6140
YizeWang wants to merge 18 commits into
isaac-sim:developfrom
YizeWang:yizew/support-multi-backends-part-2

Conversation

@YizeWang

Copy link
Copy Markdown

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
List any dependencies that are required for this change.

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (existing functionality will not work without user modification)
  • Documentation update

Screenshots

Please attach before and after screenshots of the change if applicable.

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • 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 and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

Yize Wang added 16 commits June 11, 2026 16:55
Signed-off-by: Yize Wang <yizew@nvidia.com>
Signed-off-by: Yize Wang <yizew@nvidia.com>
Signed-off-by: Yize Wang <yizew@nvidia.com>
Signed-off-by: Yize Wang <yizew@nvidia.com>
Signed-off-by: Yize Wang <yizew@nvidia.com>
Signed-off-by: Yize Wang <yizew@nvidia.com>
Signed-off-by: Yize Wang <yizew@nvidia.com>
Signed-off-by: Yize Wang <yizew@nvidia.com>
Signed-off-by: Yize Wang <yizew@nvidia.com>
Signed-off-by: Yize Wang <yizew@nvidia.com>
Signed-off-by: Yize Wang <yizew@nvidia.com>
Signed-off-by: Yize Wang <yizew@nvidia.com>
Signed-off-by: Yize Wang <yizew@nvidia.com>
Signed-off-by: Yize Wang <yizew@nvidia.com>
@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
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
# clip lower and upper bounds to have better color mapping
heights_normalized = np.clip(heights_normalized, 0.1, 0.9)
# Get the color for each vertex based on the height
color_map = kwargs.pop("color_map", "turbo")

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

"turbo" is not available anymore.

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
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.

)
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
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.

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
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.")

Copy link
Copy Markdown
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. Filed #6143.


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
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.

prim_path="/World/envs/env_.*/Object",
spawn=sim_utils.MultiAssetSpawnerCfg(
assets_cfg=[
sim_utils.ConeCfg(

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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

Signed-off-by: Yize Wang <yizew@nvidia.com>
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
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.

Signed-off-by: Yize Wang <yizew@nvidia.com>
# 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
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]

Copy link
Copy Markdown
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 XXX.

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