Skip to content

[Bug Report] Unable to run example add a new robot to Isaac Lab #5480

Closed

Description

@theunknowninfinite

If you are submitting a bug report, please fill in the following details and use the tag [bug].

Describe the bug

Unable to run example using code from https://github.com/isaac-sim/IsaacLab/blob/develop/scripts/tutorials/01_assets/add_new_robot.py.

Steps to reproduce

  • Running code using python3 scripts/tutorials/01_assets/add_new_robot.py
  • Using ./isaaclab.sh -p scripts/tutorials/01_assets/add_new_robot.py
    Terminal logs:
/home/infinity/lab/scripts/tutorials/01_assets/add_new_robot.py:151: DeprecationWarning: The function 'set_joint_velocity_target' will be deprecated in a future release. Please use 'set_joint_velocity_target_index' instead.
  scene["Jetbot"].set_joint_velocity_target(action)
Traceback (most recent call last):
  File "/home/infinity/lab/scripts/tutorials/01_assets/add_new_robot.py", line 183, in <module>
    main()
  File "/home/infinity/lab/scripts/tutorials/01_assets/add_new_robot.py", line 179, in main
    run_simulator(sim, scene)
  File "/home/infinity/lab/scripts/tutorials/01_assets/add_new_robot.py", line 151, in run_simulator
    scene["Jetbot"].set_joint_velocity_target(action)
  File "/home/infinity/lab/source/isaaclab/isaaclab/assets/articulation/base_articulation.py", line 2595, in set_joint_velocity_target
    self.set_joint_velocity_target_index(target=target, joint_ids=joint_ids, env_ids=env_ids)
  File "/home/infinity/lab/source/isaaclab_physx/isaaclab_physx/assets/articulation/articulation.py", line 2334, in set_joint_velocity_target_index
    wp.launch(
  File "/home/infinity/miniconda3/envs/lab/lib/python3.12/site-packages/warp/_src/context.py", line 7468, in launch
    pack_args(fwd_args, params, adjoint=False)
  File "/home/infinity/miniconda3/envs/lab/lib/python3.12/site-packages/warp/_src/context.py", line 7428, in pack_args
    params.append(pack_arg(kernel, arg_type, arg_name, a, device, adjoint))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/infinity/miniconda3/envs/lab/lib/python3.12/site-packages/warp/_src/context.py", line 6905, in pack_arg
    raise RuntimeError(
RuntimeError: Error launching kernel 'write_2d_data_to_buffer_with_indices', argument 'in_data' expects an array of type array(ndim=2, dtype=float32), but passed value has type Tensor.
2026-05-03T22:46:02Z [4,534ms] [Warning] [simulation_app.simulation_app] SimulationApp.close() was not called explicitly. Shutting down automatically

-->

System Info

Describe the characteristic of your environment:

  • Commit: release v3.0.0-beta
  • Isaac Sim Version: 6.0.0
  • OS: Linux Mint 22.3
  • GPU: RTX 5090
  • CUDA: 13
  • GPU Driver: 580.142

Additional context

Add any other context about the problem here.

Checklist

  • I have checked that there is no similar issue in the repo (required)
  • I have checked that the issue is not in running Isaac Sim itself and is related to the repo

Acceptance Criteria

Add the criteria for which this task is considered done. If not known at issue creation time, you can add this once the issue is assigned.

  • Criteria 1
  • Criteria 2

Activity

  1. RandomOakForest commented on May 7, 2026

    @RandomOakForest
    Collaborator

    Thank you for posting this. The team will review it and follow up.

  2. Exokern commented on May 7, 2026

    @Exokern

    This looks like a type mismatch between the tutorial and the PhysX backend:

    • The tutorial scripts/tutorials/01_assets/add_new_robot.py builds action = torch.Tensor([[10.0, 10.0]]) (a torch.Tensor).
    • BaseArticulation.set_joint_velocity_target() forwards that into set_joint_velocity_target_index(), which ends up calling wp.launch(...) in isaaclab_physx/assets/articulation/articulation.py.
    • Warp expects a wp.array there; the error you see (expects array(ndim=2, dtype=float32), but passed value has type Tensor) is consistent with passing a torch tensor straight into a Warp kernel.

    Quick workaround in the tutorial: make action a wp.array (float32, correct device) before calling set_joint_velocity_target[_index].

    Upstream fix options (small):

    1. Fix the tutorial to pass a wp.array.
    2. Or make set_joint_velocity_target_index() accept torch.Tensor and internally convert to a wp.array before the wp.launch(...) call (so the public API can consistently accept torch inputs).

    Happy to send a tiny PR for either approach if maintainers have a preference.

  3. RandomOakForest commented on May 7, 2026

    @RandomOakForest
    Collaborator

    Following up, the team is actively working to resolve this. @kellyguo11 for vis.

  4. lqxisok commented on May 8, 2026

    @lqxisok

    The follow code works well for me:

      # drive around
      if count % 100 < 75:
          # Drive straight by setting equal wheel velocities
          action = wp.from_torch(torch.Tensor([[10.0, 10.0]]).cuda())
      else:
          # Turn by applying different velocities
          action = wp.from_torch(torch.Tensor([[5.0, -5.0]]).cuda())
    
  5. theunknowninfinite commented on May 12, 2026

    @theunknowninfinite
    Author

    @Exokern @lqxisok Thank you for your suggestions.
    I tried using your code snippets but I get this error.

    Traceback (most recent call last):
      File "/home/infinity/isaac_scripts/lab_config_test.py", line 188, in <module>
        main()
      File "/home/infinity/isaac_scripts/lab_config_test.py", line 184, in main
        run_simulator(sim, scene)
      File "/home/infinity/isaac_scripts/lab_config_test.py", line 114, in run_simulator
        root_jetbot_pose = scene["Jetbot"].data.default_root_pose.torch.clone()
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    AttributeError: 'array' object has no attribute 'torch'
    

    For which when checking the type , it is of <class 'warp._src.types.array'>.

  6. theunknowninfinite commented on May 12, 2026

    @theunknowninfinite
    Author

    I tried using wp.from_torch
    The script seems to run but however there's no UI popping up and I can see this in the terminal.
    I had to pass the args -viz kit . My bad.
    The code works now with the edited code in the section below.

    Modified Code
    # Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md).
    # All rights reserved.
    #
    # SPDX-License-Identifier: BSD-3-Clause
    
    import argparse
    
    from isaaclab.app import AppLauncher
    
    # add argparse arguments
    parser = argparse.ArgumentParser(
        description="This script demonstrates adding a custom robot to an Isaac Lab environment."
    )
    parser.add_argument("--num_envs", type=int, default=1, help="Number of environments to spawn.")
    # append AppLauncher cli args
    AppLauncher.add_app_launcher_args(parser)
    # parse the arguments
    args_cli = parser.parse_args()
    
    # launch omniverse app
    app_launcher = AppLauncher(args_cli)
    simulation_app = app_launcher.app
    
    import numpy as np
    import torch
    import warp as wp
    
    
    import isaaclab.sim as sim_utils
    from isaaclab.actuators import ImplicitActuatorCfg
    from isaaclab.assets import AssetBaseCfg
    from isaaclab.assets.articulation import ArticulationCfg
    from isaaclab.scene import InteractiveScene, InteractiveSceneCfg
    from isaaclab.utils.assets import ISAAC_NUCLEUS_DIR
    
    JETBOT_CONFIG = ArticulationCfg(
        spawn=sim_utils.UsdFileCfg(usd_path=f"{ISAAC_NUCLEUS_DIR}/Robots/NVIDIA/Jetbot/jetbot.usd"),
        actuators={"wheel_acts": ImplicitActuatorCfg(joint_names_expr=[".*"], damping=None, stiffness=None)},
    )
    
    DOFBOT_CONFIG = ArticulationCfg(
        spawn=sim_utils.UsdFileCfg(
            usd_path=f"{ISAAC_NUCLEUS_DIR}/Robots/Yahboom/Dofbot/dofbot.usd",
            rigid_props=sim_utils.RigidBodyPropertiesCfg(
                disable_gravity=False,
                max_depenetration_velocity=5.0,
            ),
            articulation_props=sim_utils.ArticulationRootPropertiesCfg(
                enabled_self_collisions=True, solver_position_iteration_count=8, solver_velocity_iteration_count=0
            ),
        ),
        init_state=ArticulationCfg.InitialStateCfg(
            joint_pos={
                "joint1": 0.0,
                "joint2": 0.0,
                "joint3": 0.0,
                "joint4": 0.0,
            },
            pos=(0.25, -0.25, 0.0),
        ),
        actuators={
            "front_joints": ImplicitActuatorCfg(
                joint_names_expr=["joint[1-2]"],
                effort_limit_sim=100.0,
                velocity_limit_sim=100.0,
                stiffness=10000.0,
                damping=100.0,
            ),
            "joint3_act": ImplicitActuatorCfg(
                joint_names_expr=["joint3"],
                effort_limit_sim=100.0,
                velocity_limit_sim=100.0,
                stiffness=10000.0,
                damping=100.0,
            ),
            "joint4_act": ImplicitActuatorCfg(
                joint_names_expr=["joint4"],
                effort_limit_sim=100.0,
                velocity_limit_sim=100.0,
                stiffness=10000.0,
                damping=100.0,
            ),
        },
    )
    
    
    class NewRobotsSceneCfg(InteractiveSceneCfg):
        """Designs the scene."""
    
        # Ground-plane
        ground = AssetBaseCfg(prim_path="/World/defaultGroundPlane", spawn=sim_utils.GroundPlaneCfg())
    
        # lights
        dome_light = AssetBaseCfg(
            prim_path="/World/Light", spawn=sim_utils.DomeLightCfg(intensity=3000.0, color=(0.75, 0.75, 0.75))
        )
    
        # robot
        Jetbot = JETBOT_CONFIG.replace(prim_path="{ENV_REGEX_NS}/Jetbot")
        Dofbot = DOFBOT_CONFIG.replace(prim_path="{ENV_REGEX_NS}/Dofbot")
    
    
    def run_simulator(sim: sim_utils.SimulationContext, scene: InteractiveScene):
        sim_dt = sim.get_physics_dt()
        sim_time = 0.0
        count = 0
    
        while simulation_app.is_running():
            # reset
            if count % 500 == 0:
                # reset counters
                count = 0
                # reset the scene entities to their initial positions offset by the environment origins
                root_jetbot_pose = wp.to_torch(scene["Jetbot"].data.default_root_pose).clone()
                root_jetbot_pose[:, :3] += scene.env_origins
                root_dofbot_pose = wp.to_torch(scene["Dofbot"].data.default_root_pose).clone()
                root_dofbot_pose[:, :3] += scene.env_origins
    
                # copy the default root state to the sim for the jetbot's orientation and velocity
                scene["Jetbot"].write_root_pose_to_sim_index(root_pose=root_jetbot_pose)
                root_jetbot_vel = wp.to_torch(scene["Jetbot"].data.default_root_vel).clone()
                scene["Jetbot"].write_root_velocity_to_sim_index(root_velocity=root_jetbot_vel)
                scene["Dofbot"].write_root_pose_to_sim_index(root_pose=root_dofbot_pose)
                root_dofbot_vel = wp.to_torch(scene["Dofbot"].data.default_root_vel).clone()
                scene["Dofbot"].write_root_velocity_to_sim_index(root_velocity=root_dofbot_vel)
    
                # copy the default joint states to the sim
                joint_pos, joint_vel = (
                    wp.to_torch(scene["Jetbot"].data.default_joint_pos).clone(),
                    wp.to_torch(scene["Jetbot"].data.default_joint_vel).clone(),
                )
                scene["Jetbot"].write_joint_position_to_sim_index(position=joint_pos)
                scene["Jetbot"].write_joint_velocity_to_sim_index(velocity=joint_vel)
                joint_pos, joint_vel = (
                    wp.to_torch(scene["Dofbot"].data.default_joint_pos).clone(),
                    wp.to_torch(scene["Dofbot"].data.default_joint_vel).clone(),
                )
                scene["Dofbot"].write_joint_position_to_sim_index(position=joint_pos)
                scene["Dofbot"].write_joint_velocity_to_sim_index(velocity=joint_vel)
                # clear internal buffers
                scene.reset()
                print("[INFO]: Resetting Jetbot and Dofbot state...")
    
            # drive around
            if count % 100 < 75:
                # Drive straight by setting equal wheel velocities
                action = torch.Tensor([[10.0, 10.0]])
                # action=wp.from_torch(action).device('cuda:0')
                action = wp.from_torch(torch.Tensor([[10.0, 10.0]]).cuda())
            else:
                # Turn by applying different velocities
                action = torch.Tensor([[5.0, -5.0]])
                # action=wp.from_torch(action).device('cuda:0')
                action = wp.from_torch(torch.Tensor([[10.0, 10.0]]).cuda())
    
            scene["Jetbot"].set_joint_velocity_target(action)
    
            # wave
            wave_action = wp.to_torch(scene["Dofbot"].data.default_joint_pos)
            wave_action[:, 0:4] = 0.25 * np.sin(2 * np.pi * 0.5 * sim_time)
            scene["Dofbot"].set_joint_position_target_index(target=wave_action)
    
            scene.write_data_to_sim()
            sim.step()
            sim_time += sim_dt
            count += 1
            scene.update(sim_dt)
    
    
    def main():
        """Main function."""
        # Initialize the simulation context
        sim_cfg = sim_utils.SimulationCfg(device=args_cli.device)
        sim = sim_utils.SimulationContext(sim_cfg)
        sim.set_camera_view([3.5, 0.0, 3.2], [0.0, 0.0, 0.5])
        # Design scene
        scene_cfg = NewRobotsSceneCfg(args_cli.num_envs, env_spacing=2.0)
        scene = InteractiveScene(scene_cfg)
        # Play the simulator
        sim.reset()
        # Now we are ready!
        print("[INFO]: Setup complete...")
        # Run the simulator
        run_simulator(sim, scene)
    
    
    if __name__ == "__main__":
        main()
        simulation_app.close()
  7. CarlosEngler commented on Jun 19, 2026

    @CarlosEngler

    I had a problem in this tutorial aswell. When executing add_new_robot.py with whichever number assigned to num_envs i get the following problem:

    Command:
    ./isaaclab.sh -p scripts/tutorials/01_assets/add_new_robot.py --num_envs 2 --viz kit

    Error:

    Traceback (most recent call last):
      File "/workspace/isaaclab/scripts/tutorials/01_assets/add_new_robot.py", line 187, in <module>
        main()
      File "/workspace/isaaclab/scripts/tutorials/01_assets/add_new_robot.py", line 177, in main
        scene = InteractiveScene(scene_cfg)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/workspace/isaaclab/source/isaaclab/isaaclab/scene/interactive_scene.py", line 138, in __init__
        cfg.validate()
      File "/workspace/isaaclab/source/isaaclab/isaaclab/utils/configclass.py", line 381, in _validate
        raise TypeError(
    TypeError: Missing values detected in object NewRobotsSceneCfg for the following fields:
      - num_envs
    

    I think the problem happens due to num_envs, defined in ArgumentParser, never being assigned in NewRobotsSceneCfg(). The solution i got to this problem is by simply changing the call of NewRobotsSceneCfg() in function main to:

    scene_cfg = NewRobotsSceneCfg(num_envs=args_cli.num_envs, env_spacing=2.0)

    I tested this and got this problem both running locally and through docker, using the branch develop of IsaacLab and IsaacSim 6.0.0.

    Another thing I saw is that in the tutorial the code snippet for the run_deformable function is incomplete.

    I'm happy to send a PR if it's correct and appreciated!

  8. matthewtrepte commented on Oct 19, 2026

    @matthewtrepte
    Collaborator

    should be fixed (PR #7327 and #7120). the tutorial now builds its action tensors on sim.device and the articulation setters accept torch tensors or warp arrays. closing as fixed. pls reopen if you still hit it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions