Support Multi-Back for Demo Scripts (Part 2) and Unify Code Structure#6140
Support Multi-Back for Demo Scripts (Part 2) and Unify Code Structure#6140YizeWang wants to merge 18 commits into
Conversation
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>
Greptile SummaryThis PR unifies the structure of demo scripts to use
Confidence Score: 4/5The 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
|
| 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 |
There was a problem hiding this comment.
.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.
| 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() |
There was a problem hiding this comment.
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.
| # 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") |
There was a problem hiding this comment.
"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.") |
There was a problem hiding this comment.
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.") |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
| description="This script demonstrates different types of markers.", | ||
| conflict_handler="resolve", | ||
| ) | ||
| parser.add_argument("--physics", default="physx", choices=["physx"], help="Physics backend.") |
|
|
||
| def randomize_shape_color(prim_path_expr: str): | ||
| """Randomize the color of the geometry.""" | ||
| from pxr import Gf, Sdf |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
I replaced ConeCfg with CylinderCfg because the former is not supported in Newton.
| 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 |
There was a problem hiding this comment.
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.") |
There was a problem hiding this comment.
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.
| 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] |
There was a problem hiding this comment.
The newton backend does not support heterogeneous spawning. Filed XXX.
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
Screenshots
Please attach before and after screenshots of the change if applicable.
Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there