Skip to content

Commit a6060a9

Browse files
authored
[FIX] Defer asset imports until Kit startup (#7072)
# Description Defer the cable and deformable runtime asset imports until after `launch_simulation()` starts Kit. This prevents the standalone USD runtime from loading before Kit initializes its bundled USD runtime. The type annotations are kept via `TYPE_CHECKING` imports, matching the existing pattern in `scripts/demos/multi_asset.py` and `scripts/demos/procedural_terrain.py`. Correct the documented commands for both demos so they install the extras their default configuration actually needs. The cable demo defaults to the Kit visualizer, so it needs `--extra isaacsim`. The deformable tutorial defaults to Kit and always tetrahedralizes its volume deformables, so it needs `--extra isaacsim --extra tetrahedralization`; its OvPhysX example stays Kitless but needs `--extra ovphysx --extra tetrahedralization`. The cable examples that pass `--visualizer newton` or `--visualizer none` are intentionally left Kitless. ## Type of change - Bug fix (non-breaking change which fixes an issue) - Documentation update ## Screenshots Not applicable. ## Validation - `uv run --frozen isaaclab -f` - Cable demo completed two steps with the Kit visualizer. - Deformable-object tutorial started Kit and simulated with each of the three backends, using the documented commands. - Confirmed each documented extra is genuinely required: with the tetrahedralization dependencies unavailable, all three backends fail in `define_deformable_body_properties`. - Documentation build completed successfully. ## Checklist - [x] I have read and understood the contribution guidelines - [x] I have run the pre-commit checks - [x] I have made corresponding documentation changes - [x] My changes generate no new warnings - [x] No source-package changelog fragment is required - [x] My name already exists in `CONTRIBUTORS.md`
1 parent 135cf98 commit a6060a9

5 files changed

Lines changed: 26 additions & 14 deletions

File tree

docs/source/overview/core-concepts/physical-backends/newton/using-cables.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ in your environment:
3030
.. code-block:: bash
3131
3232
# Default Newton VBD physics with the Kit visualizer.
33-
uv run python scripts/demos/cables.py
33+
uv run --extra isaacsim python scripts/demos/cables.py
3434
3535
# Explicit Newton VBD physics with the Newton visualizer.
3636
uv run python scripts/demos/cables.py --physics newton_vbd --visualizer newton

docs/source/overview/showroom.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ A few quick showroom scripts to run and checkout:
113113

114114
.. code:: bash
115115
116-
uv run python scripts/demos/cables.py
116+
uv run --extra isaacsim python scripts/demos/cables.py
117117
118118
.. tab-item:: isaaclab.sh / isaaclab.bat
119119

docs/source/tutorials/01_assets/run_deformable_object.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ commands to the mesh nodes to move the soft body.
2525

2626
.. note::
2727

28-
This tutorial automatically tetrahedralizes volume deformables. Run it with the
29-
``tetrahedralization`` extra:
28+
This tutorial automatically tetrahedralizes volume deformables, and its default
29+
visualizer is Kit. Run it with the ``isaacsim`` and ``tetrahedralization`` extras:
3030

3131
.. code-block:: bash
3232
33-
uv run --extra tetrahedralization python scripts/tutorials/01_assets/run_deformable_object.py --visualizer kit
33+
uv run --extra isaacsim --extra tetrahedralization python scripts/tutorials/01_assets/run_deformable_object.py --visualizer kit
3434
3535
With the legacy installer, install the optional dependencies first:
3636

@@ -49,7 +49,7 @@ The tutorial corresponds to the ``run_deformable_object.py`` script in the ``scr
4949

5050
.. literalinclude:: ../../../../scripts/tutorials/01_assets/run_deformable_object.py
5151
:language: python
52-
:emphasize-lines: 65-102, 123-128, 130-139, 144-152, 154-162
52+
:emphasize-lines: 71-117, 146-151, 153-162, 167-175, 177-178, 184-189
5353
:linenos:
5454

5555

@@ -184,7 +184,7 @@ Now that we have gone through the code, let's run the script and see the result:
184184

185185
.. code-block:: bash
186186
187-
uv run python scripts/tutorials/01_assets/run_deformable_object.py --visualizer kit
187+
uv run --extra isaacsim --extra tetrahedralization python scripts/tutorials/01_assets/run_deformable_object.py --visualizer kit
188188
189189
.. tab-item:: isaaclab.sh / isaaclab.bat
190190

@@ -200,7 +200,7 @@ To run the same tutorial with the experimental Newton deformable backend:
200200

201201
.. code-block:: bash
202202
203-
uv run python scripts/tutorials/01_assets/run_deformable_object.py --backend newton_vbd --visualizer kit
203+
uv run --extra isaacsim --extra tetrahedralization python scripts/tutorials/01_assets/run_deformable_object.py --backend newton_vbd --visualizer kit
204204
205205
206206
.. tab-item:: isaaclab.sh / isaaclab.bat

scripts/demos/cables.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
.. code-block:: bash
99
1010
# Usage with default Newton VBD physics and Kit visualizer.
11-
uv run python scripts/demos/cables.py
11+
uv run --extra isaacsim python scripts/demos/cables.py
1212
1313
# Usage with explicit Newton VBD physics and Newton visualizer.
1414
uv run python scripts/demos/cables.py --physics newton_vbd --visualizer newton
@@ -23,6 +23,7 @@
2323
import argparse
2424
import math
2525
import random
26+
from typing import TYPE_CHECKING
2627

2728
from isaaclab.app import add_launcher_args, launch_simulation
2829

@@ -41,9 +42,11 @@
4142
parser.error("--num_segments must be at least 2.")
4243

4344
import isaaclab.sim as sim_utils
44-
from isaaclab.assets import CableObject, CableObjectCfg
4545
from isaaclab.physics import PhysicsCfg
4646

47+
if TYPE_CHECKING:
48+
from isaaclab.assets import CableObject
49+
4750

4851
def design_scene(num_cables: int, num_segments: int, colorize: bool) -> dict[str, CableObject]:
4952
"""Spawn a ground plane, light, and randomly oriented cable pile.
@@ -53,6 +56,8 @@ def design_scene(num_cables: int, num_segments: int, colorize: bool) -> dict[str
5356
num_segments: Number of segments per cable.
5457
colorize: Whether to give each cable a random visual material.
5558
"""
59+
from isaaclab.assets import CableObject, CableObjectCfg
60+
5661
ground_cfg = sim_utils.GroundPlaneCfg()
5762
ground_cfg.func("/World/defaultGroundPlane", ground_cfg)
5863
light_cfg = sim_utils.DomeLightCfg(intensity=3000.0, color=(0.75, 0.75, 0.75))

scripts/tutorials/01_assets/run_deformable_object.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,22 @@
99
.. code-block:: bash
1010
1111
# Usage with default PhysX physics and default kit visualizer.
12-
uv run python scripts/tutorials/01_assets/run_deformable_object.py
12+
uv run --extra isaacsim --extra tetrahedralization python scripts/tutorials/01_assets/run_deformable_object.py
1313
1414
# Usage with Newton VBD physics and default kit visualizer.
15-
uv run python scripts/tutorials/01_assets/run_deformable_object.py --backend newton_vbd
15+
uv run --extra isaacsim --extra tetrahedralization python scripts/tutorials/01_assets/run_deformable_object.py \
16+
--backend newton_vbd
1617
1718
# Usage with OvPhysX physics without a visualizer.
18-
uv run python scripts/tutorials/01_assets/run_deformable_object.py --backend ovphysx
19+
uv run --extra ovphysx --extra tetrahedralization python scripts/tutorials/01_assets/run_deformable_object.py \
20+
--backend ovphysx
1921
2022
"""
2123

2224
"""Parse CLI first so we can decide whether to launch Isaac Sim Kit."""
2325

2426
import argparse
27+
from typing import TYPE_CHECKING
2528

2629
from isaaclab.app import add_launcher_args, launch_simulation
2730

@@ -45,12 +48,16 @@
4548

4649
import isaaclab.sim as sim_utils
4750
import isaaclab.utils.math as math_utils
48-
from isaaclab.assets import DeformableObject, DeformableObjectCfg
4951
from isaaclab.physics import PhysicsCfg
5052

53+
if TYPE_CHECKING:
54+
from isaaclab.assets import DeformableObject
55+
5156

5257
def design_scene():
5358
"""Designs the scene."""
59+
from isaaclab.assets import DeformableObject, DeformableObjectCfg
60+
5461
# Ground-plane
5562
cfg = sim_utils.GroundPlaneCfg()
5663
cfg.func("/World/defaultGroundPlane", cfg)

0 commit comments

Comments
 (0)