From 50b71b62a6603aa5cfc22a282e11dab79ff43473 Mon Sep 17 00:00:00 2001 From: Kelly Guo Date: Mon, 8 Sep 2025 16:58:22 -0700 Subject: [PATCH 1/4] Adds a unit tests for catching non-headless app file launch --- .../test/app/test_non_headless_launch.py | 66 +++++++++++++++++++ .../test_kit_startup_performance.py | 1 - .../test_robot_load_performance.py | 1 - 3 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 source/isaaclab/test/app/test_non_headless_launch.py diff --git a/source/isaaclab/test/app/test_non_headless_launch.py b/source/isaaclab/test/app/test_non_headless_launch.py new file mode 100644 index 00000000000..482b322e3bf --- /dev/null +++ b/source/isaaclab/test/app/test_non_headless_launch.py @@ -0,0 +1,66 @@ +# Copyright (c) 2022-2025, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md). +# All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause + +""" +This script checks if the app can be launched with non-headless app and start the simulation. +""" + +"""Launch Isaac Sim Simulator first.""" + + +import os + +import pytest + +from isaaclab.app import AppLauncher + +# launch omniverse app +app_launcher = AppLauncher(experience="isaaclab.python.kit", headless=True) +simulation_app = app_launcher.app + +"""Rest everything follows.""" + +import isaaclab.sim as sim_utils +from isaaclab.assets import ArticulationCfg, AssetBaseCfg +from isaaclab.scene import InteractiveScene, InteractiveSceneCfg +from isaaclab.utils import configclass + + +@configclass +class SensorsSceneCfg(InteractiveSceneCfg): + """Design the scene with sensors on the robot.""" + + # ground plane + ground = AssetBaseCfg(prim_path="/World/defaultGroundPlane", spawn=sim_utils.GroundPlaneCfg()) + + +def run_simulator( + sim: sim_utils.SimulationContext, +): + """Run the simulator.""" + + count = 0 + + # Simulate physics + while simulation_app.is_running() and count < 100: + # perform step + sim.step() + count += 1 + + +@pytest.mark.isaacsim_ci +def test_non_headless_launch(): + # Initialize the simulation context + sim_cfg = sim_utils.SimulationCfg(dt=0.005) + sim = sim_utils.SimulationContext(sim_cfg) + # design scene + scene_cfg = SensorsSceneCfg(num_envs=1, 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) diff --git a/source/isaaclab/test/performance/test_kit_startup_performance.py b/source/isaaclab/test/performance/test_kit_startup_performance.py index 056b2e6293b..69ecc06c4a7 100644 --- a/source/isaaclab/test/performance/test_kit_startup_performance.py +++ b/source/isaaclab/test/performance/test_kit_startup_performance.py @@ -15,7 +15,6 @@ from isaaclab.app import AppLauncher -@pytest.mark.isaacsim_ci def test_kit_start_up_time(): """Test kit start-up time.""" start_time = time.time() diff --git a/source/isaaclab/test/performance/test_robot_load_performance.py b/source/isaaclab/test/performance/test_robot_load_performance.py index 4acf8ad6331..bca8c36d9d5 100644 --- a/source/isaaclab/test/performance/test_robot_load_performance.py +++ b/source/isaaclab/test/performance/test_robot_load_performance.py @@ -33,7 +33,6 @@ ({"name": "Anymal_D", "robot_cfg": ANYMAL_D_CFG, "expected_load_time": 40.0}, "cpu"), ], ) -@pytest.mark.isaacsim_ci def test_robot_load_performance(test_config, device): """Test robot load time.""" with build_simulation_context(device=device) as sim: From 261f49c06a563359cd9135937efaf06483977094 Mon Sep 17 00:00:00 2001 From: Kelly Guo Date: Mon, 8 Sep 2025 17:02:01 -0700 Subject: [PATCH 2/4] remove unused imports --- source/isaaclab/test/app/test_non_headless_launch.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/source/isaaclab/test/app/test_non_headless_launch.py b/source/isaaclab/test/app/test_non_headless_launch.py index 482b322e3bf..568781d9eb1 100644 --- a/source/isaaclab/test/app/test_non_headless_launch.py +++ b/source/isaaclab/test/app/test_non_headless_launch.py @@ -10,8 +10,6 @@ """Launch Isaac Sim Simulator first.""" -import os - import pytest from isaaclab.app import AppLauncher @@ -23,8 +21,6 @@ """Rest everything follows.""" import isaaclab.sim as sim_utils -from isaaclab.assets import ArticulationCfg, AssetBaseCfg -from isaaclab.scene import InteractiveScene, InteractiveSceneCfg from isaaclab.utils import configclass From da38a20738bc9e4608ef7f1894d29121f773e6f1 Mon Sep 17 00:00:00 2001 From: Kelly Guo Date: Mon, 8 Sep 2025 17:11:06 -0700 Subject: [PATCH 3/4] clean up --- source/isaaclab/test/app/test_non_headless_launch.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/isaaclab/test/app/test_non_headless_launch.py b/source/isaaclab/test/app/test_non_headless_launch.py index 568781d9eb1..a19c198f08c 100644 --- a/source/isaaclab/test/app/test_non_headless_launch.py +++ b/source/isaaclab/test/app/test_non_headless_launch.py @@ -21,6 +21,8 @@ """Rest everything follows.""" import isaaclab.sim as sim_utils +from isaaclab.assets import AssetBaseCfg +from isaaclab.scene import InteractiveScene, InteractiveSceneCfg from isaaclab.utils import configclass From 5016ca2248417c972d0f167102793b3c3f0269f4 Mon Sep 17 00:00:00 2001 From: Kelly Guo Date: Mon, 8 Sep 2025 17:17:42 -0700 Subject: [PATCH 4/4] clean up --- source/isaaclab/test/app/test_non_headless_launch.py | 1 + .../isaaclab/test/performance/test_kit_startup_performance.py | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/source/isaaclab/test/app/test_non_headless_launch.py b/source/isaaclab/test/app/test_non_headless_launch.py index a19c198f08c..52c35a10916 100644 --- a/source/isaaclab/test/app/test_non_headless_launch.py +++ b/source/isaaclab/test/app/test_non_headless_launch.py @@ -56,6 +56,7 @@ def test_non_headless_launch(): # design scene scene_cfg = SensorsSceneCfg(num_envs=1, env_spacing=2.0) scene = InteractiveScene(scene_cfg) + print(scene) # Play the simulator sim.reset() # Now we are ready! diff --git a/source/isaaclab/test/performance/test_kit_startup_performance.py b/source/isaaclab/test/performance/test_kit_startup_performance.py index 69ecc06c4a7..dfa716cd0b2 100644 --- a/source/isaaclab/test/performance/test_kit_startup_performance.py +++ b/source/isaaclab/test/performance/test_kit_startup_performance.py @@ -10,8 +10,6 @@ import time -import pytest - from isaaclab.app import AppLauncher