isaac-sim / IsaacLab

Unified framework for robot learning built on NVIDIA Isaac Sim
https://isaac-sim.github.io/IsaacLab
Other
2.13k stars 862 forks source link

[Question] Error occurs when running sb3/play.py using VSCode debugger with "--num_envs=1" option. #58

Closed PARKBONG closed 1 year ago

PARKBONG commented 1 year ago

Hi, I want to run sb3/play.py with my checkpoint.

I configured conda environment, orbit, into VSCode.

  1. Press "F1"
  2. Python: Select Interpreter
  3. Select "orbit"

Problem: --num_envs=1 option cause a problem when the first episode is done. --num_envs=2,3,4... is ok. + My Guess: type of obs or reward is numpy.array. I guess there is some dimension shrinks when --num_envs=1. Thanks!

Error Message

Exception has occurred: IndexError
index 1 is out of bounds for axis 0 with size 1
  File "/home/bong/.local/share/ov/pkg/isaac_sim-2022.2.1/Orbit/source/standalone/workflows/sb3/play.py", line 83, in main
    obs, reward, done, env_info = env.step(actions)
  File "/home/bong/.local/share/ov/pkg/isaac_sim-2022.2.1/Orbit/source/standalone/workflows/sb3/play.py", line 96, in <module>
    main()
IndexError: index 1 is out of bounds for axis 0 with size 1

image


and this is my launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "args" : ["--task","Lift-Robotiq-v0","--num_envs","1", "--checkpoint","./logs/sb3/Lift-Robotiq-v0/Apr12_07-12-28/model_16384000_steps.zip","--cpu"], // play
            "program": "${file}",
            "console": "integratedTerminal",
            "env": {
                "EXP_PATH": "${workspaceFolder}/_isaac_sim/apps",
                "RESOURCE_NAME": "IsaacSim"
            },
            "envFile": "${workspaceFolder}/.vscode/.python.env",
            "preLaunchTask": "setup_python_env"
        },
        {
            "name": "Python: Attach (windows-x86_64/linux-x86_64)",
            "type": "python",
            "request": "attach",
            "port": 3000,
            "host": "localhost",
        },
    ]
}
Mayankm96 commented 1 year ago

I tried to do this for Isaac-Franka-Reach-v0 environment and it works fine for me: both from the command line and VSCode.

PARKBONG commented 1 year ago

thank you for reproducing.

Then this issue might be affected by work.