Skip to content

Commit 97fb78a

Browse files
awoll-bdaiexploy-bot
authored andcommitted
Add CI test for export (#10)
GitOrigin-RevId: c83d0929f0db310358fe85978186a99d97380e5d
1 parent 6cf22bf commit 97fb78a

5 files changed

Lines changed: 604 additions & 356 deletions

File tree

.github/workflows/test.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
with:
3434
pixi-version: latest
3535
cache: true
36+
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
3637
environments: core
3738

3839
- name: Run Tests
@@ -57,6 +58,7 @@ jobs:
5758
with:
5859
pixi-version: latest
5960
cache: true
61+
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
6062
environments: controller
6163

6264
- name: Setup Controller Environment
@@ -70,3 +72,25 @@ jobs:
7072

7173
- name: Check Formatting
7274
run: pixi run -e controller format-check
75+
76+
77+
test-isaaclab-export:
78+
name: Test Export IsaacLab
79+
runs-on: github-gpu-runner
80+
timeout-minutes: 60
81+
steps:
82+
- name: Checkout
83+
uses: actions/checkout@v6
84+
85+
- name: Setup pixi
86+
uses: prefix-dev/setup-pixi@v0.9.4
87+
with:
88+
pixi-version: latest
89+
cache: true
90+
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
91+
environments: isaaclab
92+
93+
- name: Run Isaac Lab Export Test
94+
env:
95+
OMNI_KIT_ACCEPT_EULA: yes
96+
run: pixi run -e isaaclab export-isaaclab-ci

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Pixi & Build
22
.pixi/
33
build/
4-
pixi.lock
54

65
# python
76
__pycache__/

examples/exporter_scripts/export_isaaclab.py

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,37 @@
1515
from isaaclab_rl.rsl_rl import RslRlOnPolicyRunnerCfg
1616

1717

18-
def make_simulation_app() -> SimulationApp:
18+
def make_simulation_app() -> tuple[SimulationApp, argparse.Namespace]:
1919
# Create argument parser for headless mode
20-
parser = argparse.ArgumentParser()
20+
parser = argparse.ArgumentParser(description="Export Isaac Lab environment to ONNX")
21+
22+
# Add custom arguments
23+
parser.add_argument(
24+
"--task",
25+
type=str,
26+
default="Isaac-Velocity-Rough-G1-Play-v0",
27+
help="Name of the Isaac Lab task to export (default: Isaac-Velocity-Rough-G1-Play-v0)",
28+
)
29+
parser.add_argument(
30+
"--pause-on-failure",
31+
action="store_true",
32+
default=False,
33+
help="Pause on evaluation failure (default: False, useful for debugging)",
34+
)
2135

2236
AppLauncher.add_app_launcher_args(parser)
23-
args_cli = parser.parse_args([])
37+
args_cli = parser.parse_args()
2438
args_cli.headless = True
2539
args_cli.num_envs = 1
2640

2741
# launch omniverse app
2842
app_launcher = AppLauncher(args_cli)
2943
simulation_app = app_launcher.app
3044

31-
return simulation_app
45+
return simulation_app, args_cli
3246

3347

34-
simulation_app = make_simulation_app()
48+
simulation_app, args = make_simulation_app()
3549

3650

3751
# Import tasks to register environments
@@ -47,8 +61,10 @@ def make_simulation_app() -> SimulationApp:
4761
import exporter
4862

4963

50-
def main(task_name: str = None):
51-
# test_dir = pathlib.Path(tempfile.gettempdir()) / "exporter_tests"
64+
def export_isaaclab(
65+
task_name: str = "Isaac-Velocity-Rough-G1-Play-v0", pause_on_failure: bool = False
66+
):
67+
"""Test Isaac Lab ONNX export and evaluation pipeline."""
5268
test_dir = pathlib.Path(__file__).parent / "exporter_tests"
5369

5470
task_device = "cpu"
@@ -96,12 +112,13 @@ def main(task_name: str = None):
96112
# Evaluate.
97113
evaluate_steps = 200
98114
with torch.inference_mode():
99-
exporter.evaluate(
115+
export_ok, _ = exporter.evaluate(
100116
env=exportable_env,
101117
context_manager=exportable_env.context_manager(),
102118
session_wrapper=session_wrapper,
103119
num_steps=evaluate_steps,
104120
verbose=True,
121+
pause_on_failure=pause_on_failure,
105122
)
106123

107124
# Close simulation app.
@@ -110,10 +127,17 @@ def main(task_name: str = None):
110127
SimulationContext.clear_instance()
111128
simulation_app.close()
112129

113-
print("Done.")
130+
assert export_ok, "ONNX export validation failed"
114131

115132

116133
if __name__ == "__main__":
117-
# main(task_name="Isaac-Velocity-Flat-Anymal-C-Play-v0")
118-
# main(task_name="Isaac-Velocity-Rough-Anymal-C-Play-v0")
119-
main(task_name="Isaac-Velocity-Rough-G1-Play-v0")
134+
import sys
135+
136+
try:
137+
export_isaaclab(task_name=args.task, pause_on_failure=args.pause_on_failure)
138+
except Exception as e:
139+
print(f"❌ Test ERROR: {e}")
140+
import traceback
141+
142+
traceback.print_exc()
143+
sys.exit(1)

0 commit comments

Comments
 (0)