Skip to content

Commit 74fb39e

Browse files
authored
Removes dependency on XformPrim class for create_prim (#4307)
# Description This MR removes the dependency on Isaac Sim XformPrim class for creating prims. The class mainly handled setting the world or local poses, as well as restting Xform operations. These are rather simple calls for which we don't need to go through Isaac Sim. The MR adds a new `transform` submodule that contains all the relevant functions as well as their tests. Fixes # (issue) ## Type of change - New feature (non-breaking change which adds functionality) - Breaking change (existing functionality will not work without user modification) ## Checklist - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] 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 54cf64b commit 74fb39e

File tree

12 files changed

+2273
-304
lines changed

12 files changed

+2273
-304
lines changed

docs/source/api/lab/isaaclab.sim.utils.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
stage
1111
queries
1212
prims
13+
transforms
1314
semantics
1415
legacy
1516

@@ -34,6 +35,13 @@ Prims
3435
:members:
3536
:show-inheritance:
3637

38+
Transforms
39+
----------
40+
41+
.. automodule:: isaaclab.sim.utils.transforms
42+
:members:
43+
:show-inheritance:
44+
3745
Semantics
3846
---------
3947

source/isaaclab/config/extension.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
# Note: Semantic Versioning is used: https://semver.org/
4-
version = "0.51.1"
4+
version = "0.52.0"
55

66
# Description
77
title = "Isaac Lab framework for Robot Learning"

source/isaaclab/docs/CHANGELOG.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
Changelog
22
---------
33

4+
0.52.0 (2026-01-02)
5+
~~~~~~~~~~~~~~~~~~~
6+
7+
Added
8+
^^^^^
9+
10+
* Added :mod:`~isaaclab.sim.utils.transforms` module to handle USD Xform operations.
11+
* Added passing of ``stage`` to the :func:`~isaaclab.sim.utils.prims.create_prim` function
12+
inside spawning functions to allow for the creation of prims in a specific stage.
13+
14+
Changed
15+
^^^^^^^
16+
17+
* Changed :func:`~isaaclab.sim.utils.prims.create_prim` function to use the :mod:`~isaaclab.sim.utils.transforms`
18+
module for USD Xform operations. It removes the usage of Isaac Sim's XformPrim class.
19+
20+
421
0.51.2 (2025-12-30)
522
~~~~~~~~~~~~~~~~~~~
623

source/isaaclab/isaaclab/sim/spawners/from_files/from_files.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def spawn_ground_plane(
198198

199199
# Spawn Ground-plane
200200
if not stage.GetPrimAtPath(prim_path).IsValid():
201-
create_prim(prim_path, usd_path=cfg.usd_path, translation=translation, orientation=orientation)
201+
create_prim(prim_path, usd_path=cfg.usd_path, translation=translation, orientation=orientation, stage=stage)
202202
else:
203203
raise ValueError(f"A prim already exists at path: '{prim_path}'.")
204204

@@ -327,6 +327,7 @@ def _spawn_from_usd_file(
327327
translation=translation,
328328
orientation=orientation,
329329
scale=cfg.scale,
330+
stage=stage,
330331
)
331332
else:
332333
logger.warning(f"A prim already exists at prim path: '{prim_path}'.")

source/isaaclab/isaaclab/sim/spawners/lights/lights.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ def spawn_light(
5050
if stage.GetPrimAtPath(prim_path).IsValid():
5151
raise ValueError(f"A prim already exists at path: '{prim_path}'.")
5252
# create the prim
53-
prim = create_prim(prim_path, prim_type=cfg.prim_type, translation=translation, orientation=orientation)
53+
prim = create_prim(
54+
prim_path, prim_type=cfg.prim_type, translation=translation, orientation=orientation, stage=stage
55+
)
5456

5557
# convert to dict
5658
cfg = cfg.to_dict()

source/isaaclab/isaaclab/sim/spawners/shapes/shapes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def _spawn_geom_from_prim_type(
282282

283283
# spawn geometry if it doesn't exist.
284284
if not stage.GetPrimAtPath(prim_path).IsValid():
285-
create_prim(prim_path, prim_type="Xform", translation=translation, orientation=orientation)
285+
create_prim(prim_path, prim_type="Xform", translation=translation, orientation=orientation, stage=stage)
286286
else:
287287
raise ValueError(f"A prim already exists at path: '{prim_path}'.")
288288

@@ -291,7 +291,7 @@ def _spawn_geom_from_prim_type(
291291
mesh_prim_path = geom_prim_path + "/mesh"
292292

293293
# create the geometry prim
294-
create_prim(mesh_prim_path, prim_type, scale=scale, attributes=attributes)
294+
create_prim(mesh_prim_path, prim_type, scale=scale, attributes=attributes, stage=stage)
295295
# apply collision properties
296296
if cfg.collision_props is not None:
297297
schemas.define_collision_properties(mesh_prim_path, cfg.collision_props)

source/isaaclab/isaaclab/sim/spawners/wrappers/wrappers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def spawn_multi_asset(
6767

6868
# find a free prim path to hold all the template prims
6969
template_prim_path = sim_utils.get_next_free_prim_path("/World/Template", stage=stage)
70-
sim_utils.create_prim(template_prim_path, "Scope")
70+
sim_utils.create_prim(template_prim_path, "Scope", stage=stage)
7171

7272
# spawn everything first in a "Dataset" prim
7373
proto_prim_paths = list()
@@ -116,7 +116,7 @@ def spawn_multi_asset(
116116
Sdf.CopySpec(env_spec.layer, Sdf.Path(proto_path), env_spec.layer, Sdf.Path(prim_path))
117117

118118
# delete the dataset prim after spawning
119-
sim_utils.delete_prim(template_prim_path)
119+
sim_utils.delete_prim(template_prim_path, stage=stage)
120120

121121
# set carb setting to indicate Isaac Lab's environments that different prims have been spawned
122122
# at varying prim paths. In this case, PhysX parser shouldn't optimize the stage parsing.

source/isaaclab/isaaclab/sim/utils/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@
1010
from .queries import * # noqa: F401, F403
1111
from .semantics import * # noqa: F401, F403
1212
from .stage import * # noqa: F401, F403
13+
from .transforms import * # noqa: F401, F403

0 commit comments

Comments
 (0)