Skip to content

Commit 82cb320

Browse files
KumoLiukellyguo11
andauthored
Applies semantic_tags to ground (#2410)
# Description <!-- Thank you for your interest in sending a pull request. Please make sure to check the contribution guidelines. Link: https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html --> The check [here](https://github.com/isaac-sim/IsaacLab/blob/2e6946afb9b26f6949d4b1fd0a00e9f4ef733fcc/source/isaaclab/isaaclab/sim/utils.py#L260): the [RigidBodyMaterialCfg](https://github.com/isaac-sim/IsaacLab/blob/2e6946afb9b26f6949d4b1fd0a00e9f4ef733fcc/source/isaaclab/isaaclab/sim/spawners/materials/physics_materials_cfg.py#L30) used by [GroundPlaneCfg](https://github.com/isaac-sim/IsaacLab/blob/2e6946afb9b26f6949d4b1fd0a00e9f4ef733fcc/source/isaaclab/isaaclab/sim/spawners/from_files/from_files_cfg.py#L158) lacks a semantic_tags attribute. So the semantic_tags will not set to the ground correctly, then the semantic_segmentation_mapping can not been correctly mapped. Fixes # (issue) <!-- As a practice, it is recommended to open an issue to have discussions on the proposed pull request. This makes it easier for the community to keep track of what is being developed or added, and if a given feature is demanded by more than one party. --> ## Type of change <!-- As you go through the list, delete the ones that are not applicable. --> - Bug fix (non-breaking change which fixes an issue) ## Screenshots Please attach before and after screenshots of the change if applicable. Ground didn't been mapping correctly. | Before | After | | ------ | ----- | | ![image](https://github.com/user-attachments/assets/904c8223-4100-45d9-b0ea-ab54833269e3) | ![Screenshot 2025-04-29 at 17 57 24](https://github.com/user-attachments/assets/4ef18c5f-8587-4ed0-9890-c7dfaae30675)| <!-- To upload images to a PR -- simply drag and drop an image while in edit mode and it should upload the image directly. You can then paste that source into the above before/after sections. --> ## Checklist - [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 - [ ] I have added tests that prove my fix is effective or that my feature works - [x] 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 <!-- As you go through the checklist above, you can mark something as done by putting an x character in it For example, - [x] I have done this task - [ ] I have not done this task --> --------- Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> Co-authored-by: Kelly Guo <kellyg@nvidia.com>
1 parent 9be0de5 commit 82cb320

File tree

4 files changed

+28
-3
lines changed

4 files changed

+28
-3
lines changed

CONTRIBUTORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ Guidelines for modifications:
108108
* Yang Jin
109109
* Yanzi Zhu
110110
* Yujian Zhang
111+
* Yun Liu
111112
* Zhengyu Zhang
112113
* Ziqi Fan
113114

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.38.0"
4+
version = "0.39.0"
55

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

source/isaaclab/docs/CHANGELOG.rst

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

4+
0.39.0 (2025-05-03)
5+
~~~~~~~~~~~~~~~~~~~
6+
7+
Added
8+
^^^^^
9+
10+
* Added semantic tags in :func:`isaaclab.sim.spawners.from_files.spawn_ground_plane`.
11+
This allows for :attr:`semantic_segmentation_mapping` to be used when using the ground plane spawner.
12+
13+
414
0.38.0 (2025-04-01)
515
~~~~~~~~~~~~~~~~~~
616

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import isaacsim.core.utils.stage as stage_utils
1212
import omni.kit.commands
1313
import omni.log
14-
from pxr import Gf, Sdf, Usd
14+
from pxr import Gf, Sdf, Semantics, Usd
1515

1616
from isaaclab.sim import converters, schemas
1717
from isaaclab.sim.utils import bind_physics_material, bind_visual_material, clone, select_usd_variants
@@ -173,8 +173,22 @@ def spawn_ground_plane(
173173
# It isn't bright enough and messes up with the user's lighting settings
174174
omni.kit.commands.execute("ToggleVisibilitySelectedPrims", selected_paths=[f"{prim_path}/SphereLight"])
175175

176+
prim = prim_utils.get_prim_at_path(prim_path)
177+
# Apply semantic tags
178+
if hasattr(cfg, "semantic_tags") and cfg.semantic_tags is not None:
179+
# note: taken from replicator scripts.utils.utils.py
180+
for semantic_type, semantic_value in cfg.semantic_tags:
181+
# deal with spaces by replacing them with underscores
182+
semantic_type_sanitized = semantic_type.replace(" ", "_")
183+
semantic_value_sanitized = semantic_value.replace(" ", "_")
184+
# set the semantic API for the instance
185+
instance_name = f"{semantic_type_sanitized}_{semantic_value_sanitized}"
186+
sem = Semantics.SemanticsAPI.Apply(prim, instance_name)
187+
# create semantic type and data attributes
188+
sem.CreateSemanticTypeAttr().Set(semantic_type)
189+
sem.CreateSemanticDataAttr().Set(semantic_value)
176190
# return the prim
177-
return prim_utils.get_prim_at_path(prim_path)
191+
return prim
178192

179193

180194
"""

0 commit comments

Comments
 (0)