Skip to content

Commit 80cff16

Browse files
authored
Passes device from CLI args to simulation config in standalone scripts (#1114)
# Description This pull request fixes an issue where the device was being parsed by the app launcher but not set into the scripts. This change ensures that the device is correctly passed from CLI arguments to the simulation configuration in standalone scripts. ## Type of change - Bug fix (non-breaking change which fixes an issue) ## Checklist - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [ ] 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 and the corresponding version in the extension's `config/extension.toml` file - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there
1 parent 7b4dde8 commit 80cff16

File tree

22 files changed

+51
-58
lines changed

22 files changed

+51
-58
lines changed

docs/source/how-to/estimate_how_many_cameras_can_run.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ numbers of cameras that can run in your task environment up to a
2323
certain specified system resource utilization threshold (without training; taking zero actions
2424
at each timestep).
2525

26-
This guide accompanies the ``benchmark_cameras.py`` script in the ``IsaacLab/source/standalone/tutorials/04_sensors``
26+
This guide accompanies the ``benchmark_cameras.py`` script in the ``source/standalone/benchmarks``
2727
directory.
2828

2929
.. dropdown:: Code for benchmark_cameras.py
3030
:icon: code
3131

32-
.. literalinclude:: ../../../source/standalone/tutorials/04_sensors/benchmark_cameras.py
32+
.. literalinclude:: ../../../source/standalone/benchmarks/benchmark_cameras.py
3333
:language: python
3434
:linenos:
3535

@@ -41,7 +41,7 @@ First, run
4141

4242
.. code-block:: bash
4343
44-
./isaaclab.sh -p source/standalone/tutorials/04_sensors/benchmark_cameras.py -h
44+
./isaaclab.sh -p source/standalone/benchmarks/benchmark_cameras.py -h
4545
4646
to see all possible parameters you can vary with this utility.
4747

@@ -61,7 +61,7 @@ only in RGB mode, run
6161

6262
.. code-block:: bash
6363
64-
./isaaclab.sh -p source/standalone/tutorials/04_sensors/benchmark_cameras.py \
64+
./isaaclab.sh -p source/standalone/benchmarks/benchmark_cameras.py \
6565
--task Isaac-Cartpole-v0 --num_tiled_cameras 100 \
6666
--task_num_cameras_per_env 2 \
6767
--tiled_camera_data_types rgb
@@ -74,7 +74,7 @@ you can run with cartpole, you could run:
7474

7575
.. code-block:: bash
7676
77-
./isaaclab.sh -p source/standalone/tutorials/04_sensors/benchmark_cameras.py \
77+
./isaaclab.sh -p source/standalone/benchmarks/benchmark_cameras.py \
7878
--task Isaac-Cartpole-v0 --num_tiled_cameras 100 \
7979
--task_num_cameras_per_env 2 \
8080
--tiled_camera_data_types rgb --autotune \
@@ -97,7 +97,7 @@ For example, to view 100 random objects with 2 standard cameras, one could run
9797

9898
.. code-block:: bash
9999
100-
./isaaclab.sh -p source/standalone/tutorials/04_sensors/benchmark_cameras.py \
100+
./isaaclab.sh -p source/standalone/benchmarks/benchmark_cameras.py \
101101
--height 100 --width 100 --num_standard_cameras 2 \
102102
--standard_camera_data_types instance_segmentation_fast normals --num_objects 100 \
103103
--experiment_length 100
@@ -118,4 +118,4 @@ If your system has a hard time handling the desired cameras, you can try the fol
118118
- Decrease the number of objects in the scene
119119

120120
If your system is able to handle the amount of cameras, then the time statistics will be printed to the terminal.
121-
After the simulations stops it can be closed with CTRL C.
121+
After the simulations stops it can be closed with CTRL+C.

docs/source/overview/environments.rst

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ Classic environments that are based on IsaacGymEnvs implementation of MuJoCo-sty
5353
| | | |
5454
| | |cartpole-direct-link| | |
5555
+------------------+-----------------------------+-------------------------------------------------------------------------+
56-
| |cartpole| | |manager-camera-rgb-link| | Move the cart to keep the pole upwards in the classic cartpole control |
56+
| |cartpole| | |cartpole-rgb-link| | Move the cart to keep the pole upwards in the classic cartpole control |
5757
| | | and perceptive inputs |
58-
| | |manager-camera-dpt-link| | |
58+
| | |cartpole-depth-link| | |
5959
| | | |
60-
| | |cartpole-camera-rgb-link| | |
60+
| | |cartpole-rgb-direct-link| | |
6161
| | | |
62-
| | |cartpole-camera-dpt-link| | |
62+
| | |cartpole-depth-direct-link|| |
6363
+------------------+-----------------------------+-------------------------------------------------------------------------+
6464

6565
.. |humanoid| image:: ../_static/tasks/classic/humanoid.jpg
@@ -69,16 +69,14 @@ Classic environments that are based on IsaacGymEnvs implementation of MuJoCo-sty
6969
.. |humanoid-link| replace:: `Isaac-Humanoid-v0 <https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/manager_based/classic/humanoid/humanoid_env_cfg.py>`__
7070
.. |ant-link| replace:: `Isaac-Ant-v0 <https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/manager_based/classic/ant/ant_env_cfg.py>`__
7171
.. |cartpole-link| replace:: `Isaac-Cartpole-v0 <https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/manager_based/classic/cartpole/cartpole_env_cfg.py>`__
72+
.. |cartpole-rgb-link| replace:: `Isaac-Cartpole-RGB-v0 <https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/manager_based/classic/cartpole/cartpole_camera_env_cfg.py>`__
73+
.. |cartpole-depth-link| replace:: `Isaac-Cartpole-Depth-v0 <https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/manager_based/classic/cartpole/cartpole_camera_env_cfg.py>`__
7274

7375
.. |humanoid-direct-link| replace:: `Isaac-Humanoid-Direct-v0 <https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/direct/humanoid/humanoid_env.py>`__
7476
.. |ant-direct-link| replace:: `Isaac-Ant-Direct-v0 <https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/direct/ant/ant_env.py>`__
75-
.. |manager-camera-rgb-link| replace:: `Isaac-Cartpole-RGB-v0 <https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/manager_based/classic/cartpole/cartpole_camera_env_cfg.py>`__
76-
.. |manager-camera-dpt-link| replace:: `Isaac-Cartpole-Depth-v0 <https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/manager_based/classic/cartpole/cartpole_camera_env_cfg.py>`__
7777
.. |cartpole-direct-link| replace:: `Isaac-Cartpole-Direct-v0 <https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/direct/cartpole/cartpole_env.py>`__
78-
.. |manager-camera-rgb-link| replace:: `Isaac-Cartpole-RGB-v0 <https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/manager_based/classic/cartpole/cartpole_camera_env_cfg.py>`__
79-
.. |manager-camera-dpt-link| replace:: `Isaac-Cartpole-Depth-v0 <https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/manager_based/classic/cartpole/cartpole_camera_env_cfg.py>`__
80-
.. |cartpole-camera-rgb-link| replace:: `Isaac-Cartpole-RGB-Camera-Direct-v0 <https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/direct/cartpole/cartpole_camera_env.py>`__
81-
.. |cartpole-camera-dpt-link| replace:: `Isaac-Cartpole-Depth-Camera-Direct-v0 <https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/direct/cartpole/cartpole_camera_env.py>`__
78+
.. |cartpole-rgb-direct-link| replace:: `Isaac-Cartpole-RGB-Camera-Direct-v0 <https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/direct/cartpole/cartpole_camera_env.py>`__
79+
.. |cartpole-depth-direct-link| replace:: `Isaac-Cartpole-Depth-Camera-Direct-v0 <https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/direct/cartpole/cartpole_camera_env.py>`__
8280

8381
Manipulation
8482
~~~~~~~~~~~~

source/extensions/omni.isaac.lab/omni/isaac/lab/app/app_launcher.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,11 @@ def add_app_launcher_args(parser: argparse.ArgumentParser) -> None:
178178
* ``experience`` (str): The experience file to load when launching the SimulationApp. If a relative path
179179
is provided, it is resolved relative to the ``apps`` folder in Isaac Sim and Isaac Lab (in that order).
180180
181-
If provided as an empty string, the experience file is determined based on the headless flag:
181+
If provided as an empty string, the experience file is determined based on the command-line flags:
182182
183183
* If headless and enable_cameras are True, the experience file is set to ``isaaclab.python.headless.rendering.kit``.
184184
* If headless is False and enable_cameras is True, the experience file is set to ``isaaclab.python.rendering.kit``.
185-
* If headless is False and enable_cameras is False, the experience file is set to ``isaaclab.python.kit``.
185+
* If headless and enable_cameras are False, the experience file is set to ``isaaclab.python.kit``.
186186
* If headless is True and enable_cameras is False, the experience file is set to ``isaaclab.python.headless.kit``.
187187
188188
Args:

source/standalone/tutorials/04_sensors/benchmark_cameras.py renamed to source/standalone/benchmarks/benchmark_cameras.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@
55

66
"""
77
This script might help you determine how many cameras your system can realistically run
8-
at different desired settings. You can supply different task environments
9-
to inject cameras into, or just test a sample scene. Additionally,
10-
you can automatically find the maximum amount of cameras you can run a task with through the
11-
autotune functionality.
8+
at different desired settings.
9+
10+
You can supply different task environments to inject cameras into, or just test a sample scene.
11+
Additionally, you can automatically find the maximum amount of cameras you can run a task with
12+
through the auto-tune functionality.
1213
1314
.. code-block:: bash
1415
1516
# Usage with GUI
16-
./isaaclab.sh -p source/standalone/tutorials/04_sensors/benchmark_cameras.py -h
17+
./isaaclab.sh -p source/standalone/benchmarks/benchmark_cameras.py -h
1718
1819
# Usage with headless
19-
./isaaclab.sh -p source/standalone/tutorials/04_sensors/benchmark_cameras.py -h --headless
20+
./isaaclab.sh -p source/standalone/benchmarks/benchmark_cameras.py -h --headless
2021
2122
"""
2223

@@ -753,7 +754,7 @@ def main():
753754
print("[INFO]: Designing the scene")
754755
if args_cli.task is None:
755756
print("[INFO]: No task environment provided, creating random scene.")
756-
sim_cfg = sim_utils.SimulationCfg(device="cpu" if args_cli.cpu else "cuda")
757+
sim_cfg = sim_utils.SimulationCfg(device=args_cli.device)
757758
sim = sim_utils.SimulationContext(sim_cfg)
758759
# Set main camera
759760
sim.set_camera_view([2.5, 2.5, 2.5], [0.0, 0.0, 0.0])

source/standalone/demos/arms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def run_simulator(sim: sim_utils.SimulationContext, entities: dict[str, Articula
210210
def main():
211211
"""Main function."""
212212
# Initialize the simulation context
213-
sim_cfg = sim_utils.SimulationCfg()
213+
sim_cfg = sim_utils.SimulationCfg(device=args_cli.device)
214214
sim = sim_utils.SimulationContext(sim_cfg)
215215
# Set main camera
216216
sim.set_camera_view([3.5, 0.0, 3.2], [0.0, 0.0, 0.5])

source/standalone/demos/bipeds.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@
4747

4848
def main():
4949
"""Main function."""
50-
5150
# Load kit helper
52-
sim = SimulationContext(sim_utils.SimulationCfg(dt=0.005))
51+
sim_cfg = sim_utils.SimulationCfg(dt=0.005, device=args_cli.device)
52+
sim = SimulationContext(sim_cfg)
5353
# Set main camera
5454
sim.set_camera_view(eye=[3.0, 0.0, 2.25], target=[0.0, 0.0, 1.0])
5555

source/standalone/demos/cameras.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
.. code-block:: bash
1010
1111
# Usage
12-
./isaaclab.sh -p source/standalone/demos/cameras.py --disable_fabric
12+
./isaaclab.sh -p source/standalone/demos/cameras.py --enable_cameras
1313
1414
# Usage in headless mode
15-
./isaaclab.sh -p source/standalone/demos/cameras.py --headless --enable_cameras --disable_fabric
15+
./isaaclab.sh -p source/standalone/demos/cameras.py --headless --enable_cameras
1616
1717
"""
1818

@@ -274,16 +274,8 @@ def run_simulator(sim: sim_utils.SimulationContext, scene: InteractiveScene):
274274

275275
def main():
276276
"""Main function."""
277-
278-
# note: tile rendered cameras doesn't update the camera poses when using the GPU pipeline and Fabric.
279-
# this is a bug which should be fixed in the future releases.
280-
sim_cfg = sim_utils.SimulationCfg(dt=0.005)
281-
# check if fabric is enabled
282-
if args_cli.disable_fabric:
283-
sim_cfg.use_fabric = False
284-
sim_cfg.device = "cpu"
285-
286277
# Initialize the simulation context
278+
sim_cfg = sim_utils.SimulationCfg(dt=0.005, device=args_cli.device, use_fabric=not args_cli.disable_fabric)
287279
sim = sim_utils.SimulationContext(sim_cfg)
288280
# Set main camera
289281
sim.set_camera_view(eye=[3.5, 3.5, 3.5], target=[0.0, 0.0, 0.0])

source/standalone/demos/deformables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def run_simulator(sim: sim_utils.SimulationContext, entities: dict[str, Deformab
177177
def main():
178178
"""Main function."""
179179
# Initialize the simulation context
180-
sim_cfg = sim_utils.SimulationCfg(dt=0.01)
180+
sim_cfg = sim_utils.SimulationCfg(dt=0.01, device=args_cli.device)
181181
sim = sim_utils.SimulationContext(sim_cfg)
182182
# Set main camera
183183
sim.set_camera_view([4.0, 4.0, 3.0], [0.5, 0.5, 0.0])

source/standalone/demos/hands.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ def run_simulator(sim: sim_utils.SimulationContext, entities: dict[str, Articula
143143

144144
def main():
145145
"""Main function."""
146-
147146
# Initialize the simulation context
148-
sim = sim_utils.SimulationContext(sim_utils.SimulationCfg(dt=0.01))
147+
sim_cfg = sim_utils.SimulationCfg(dt=0.01, device=args_cli.device)
148+
sim = sim_utils.SimulationContext(sim_cfg)
149149
# Set main camera
150150
sim.set_camera_view(eye=[0.0, -0.5, 1.5], target=[0.0, -0.2, 0.5])
151151
# design scene

source/standalone/demos/markers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ def define_markers() -> VisualizationMarkers:
9494
def main():
9595
"""Main function."""
9696
# Load kit helper
97-
sim = SimulationContext(sim_utils.SimulationCfg(dt=0.01))
97+
sim_cfg = sim_utils.SimulationCfg(dt=0.01, device=args_cli.device)
98+
sim = SimulationContext(sim_cfg)
9899
# Set main camera
99100
sim.set_camera_view([0.0, 18.0, 12.0], [0.0, 3.0, 0.0])
100101

0 commit comments

Comments
 (0)