Skip to content

Commit c32db68

Browse files
Replaces nucleus_utils with reimplementation as part of IsaacLab (#3921)
# Description Replaces import of ``` try: import isaacsim.storage.native as nucleus_utils except ModuleNotFoundError: import isaacsim.core.utils.nucleus as nucleus_utils ``` with own utils implemented inside the sim utils folder. ``` import isaaclab.sim.utils.nucleus as nucleus_utils ``` ## Type of change - Dependency removal ## Checklist - [ ] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [ ] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [ ] I have made corresponding changes to the documentation - [ ] 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 - [ ] I have added my name to the `CONTRIBUTORS.md` or my name already exists there --------- Co-authored-by: Octi Zhang <zhengyuz@nvidia.com>
1 parent 7cfd67c commit c32db68

File tree

7 files changed

+88
-18
lines changed

7 files changed

+88
-18
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright (c) 2022-2025, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md).
2+
# All rights reserved.
3+
#
4+
# SPDX-License-Identifier: BSD-3-Clause
5+
6+
from .utils import * # noqa: F401, F403
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Copyright (c) 2022-2025, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md).
2+
# All rights reserved.
3+
#
4+
# SPDX-License-Identifier: BSD-3-Clause
5+
6+
import logging
7+
8+
import carb
9+
import omni.client
10+
from omni.client import Result
11+
12+
logger = logging.getLogger(__name__)
13+
14+
DEFAULT_ASSET_ROOT_PATH_SETTING = "/persistent/isaac/asset_root/default"
15+
DEFAULT_ASSET_ROOT_TIMEOUT_SETTING = "/persistent/isaac/asset_root/timeout"
16+
17+
18+
def check_server(server: str, path: str, timeout: float = 10.0) -> bool:
19+
"""Check a specific server for a path
20+
21+
Args:
22+
server (str): Name of Nucleus server
23+
path (str): Path to search
24+
timeout (float): Default value: 10 seconds
25+
26+
Returns:
27+
bool: True if folder is found
28+
"""
29+
logger.info(f"Checking path: {server}{path}")
30+
# Increase hang detection timeout
31+
omni.client.set_hang_detection_time_ms(20000)
32+
result, _ = omni.client.stat(f"{server}{path}")
33+
if result == Result.OK:
34+
logger.info(f"Success: {server}{path}")
35+
return True
36+
else:
37+
logger.info(f"Failure: {server}{path} not accessible")
38+
return False
39+
40+
41+
def get_assets_root_path(*, skip_check: bool = False) -> str:
42+
"""Tries to find the root path to the Isaac Sim assets on a Nucleus server
43+
44+
Args:
45+
skip_check (bool): If True, skip the checking step to verify that the resolved path exists.
46+
47+
Raises:
48+
RuntimeError: if the root path setting is not set.
49+
RuntimeError: if the root path is not found.
50+
51+
Returns:
52+
url (str): URL of Nucleus server with root path to assets folder.
53+
"""
54+
55+
# get timeout
56+
timeout = carb.settings.get_settings().get(DEFAULT_ASSET_ROOT_TIMEOUT_SETTING)
57+
if not isinstance(timeout, (int, float)):
58+
timeout = 10.0
59+
60+
# resolve path
61+
logger.info(f"Check {DEFAULT_ASSET_ROOT_PATH_SETTING} setting")
62+
default_asset_root = carb.settings.get_settings().get(DEFAULT_ASSET_ROOT_PATH_SETTING)
63+
if not default_asset_root:
64+
raise RuntimeError(f"The '{DEFAULT_ASSET_ROOT_PATH_SETTING}' setting is not set")
65+
if skip_check:
66+
return default_asset_root
67+
68+
# check path
69+
result = check_server(default_asset_root, "/Isaac", timeout)
70+
if result:
71+
result = check_server(default_asset_root, "/NVIDIA", timeout)
72+
if result:
73+
logger.info(f"Assets root found at {default_asset_root}")
74+
return default_asset_root
75+
76+
raise RuntimeError(f"Could not find assets root folder: {default_asset_root}")

source/isaaclab/isaaclab/sim/utils.py renamed to source/isaaclab/isaaclab/sim/utils/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@
3232
except ModuleNotFoundError:
3333
from pxr import Semantics
3434

35+
from isaaclab.sim import schemas
3536
from isaaclab.utils.string import to_camel_case
3637

37-
from . import schemas
38-
3938
if TYPE_CHECKING:
4039
from .spawners.spawner_cfg import SpawnerCfg
4140

source/isaaclab/test/deps/isaacsim/check_camera.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@
4545
import os
4646
import random
4747

48-
try:
49-
import isaacsim.storage.native as nucleus_utils
50-
except ModuleNotFoundError:
51-
import isaacsim.core.utils.nucleus as nucleus_utils
52-
5348
import isaacsim.core.utils.prims as prim_utils
5449
import omni.replicator.core as rep
5550
from isaacsim.core.api.world import World
@@ -58,6 +53,8 @@
5853
from PIL import Image, ImageChops
5954
from pxr import Gf, UsdGeom
6055

56+
import isaaclab.sim.utils.nucleus as nucleus_utils
57+
6158
# check nucleus connection
6259
if nucleus_utils.get_assets_root_path() is None:
6360
msg = (

source/isaaclab/test/deps/isaacsim/check_floating_base_made_fixed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import logging
3434
import torch
3535

36-
import isaacsim.core.utils.nucleus as nucleus_utils
3736
import isaacsim.core.utils.prims as prim_utils
3837
import isaacsim.core.utils.stage as stage_utils
3938
import omni.kit.commands
@@ -45,6 +44,7 @@
4544

4645
# import logger
4746
logger = logging.getLogger(__name__)
47+
import isaaclab.sim.utils.nucleus as nucleus_utils
4848

4949
# check nucleus connection
5050
if nucleus_utils.get_assets_root_path() is None:

source/isaaclab/test/deps/isaacsim/check_legged_robot_clone.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@
4444
import os
4545
import torch
4646

47-
try:
48-
import isaacsim.storage.native as nucleus_utils
49-
except ModuleNotFoundError:
50-
import isaacsim.core.utils.nucleus as nucleus_utils
51-
5247
import isaacsim.core.utils.prims as prim_utils
5348
from isaacsim.core.api.world import World
5449
from isaacsim.core.cloner import GridCloner
@@ -57,6 +52,7 @@
5752

5853
# import logger
5954
logger = logging.getLogger(__name__)
55+
import isaaclab.sim.utils.nucleus as nucleus_utils
6056

6157
# check nucleus connection
6258
if nucleus_utils.get_assets_root_path() is None:

source/isaaclab/test/deps/isaacsim/check_ref_count.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,13 @@
3838
import logging
3939
import torch # noqa: F401
4040

41-
try:
42-
import isaacsim.storage.native as nucleus_utils
43-
except ModuleNotFoundError:
44-
import isaacsim.core.utils.nucleus as nucleus_utils
45-
4641
import isaacsim.core.utils.prims as prim_utils
4742
from isaacsim.core.api.simulation_context import SimulationContext
4843
from isaacsim.core.prims import Articulation
4944

5045
# import logger
5146
logger = logging.getLogger(__name__)
47+
import isaaclab.sim.utils.nucleus as nucleus_utils
5248

5349
# check nucleus connection
5450
if nucleus_utils.get_assets_root_path() is None:

0 commit comments

Comments
 (0)