Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions isaaclab_arena/assets/background_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
#
# SPDX-License-Identifier: Apache-2.0

from __future__ import annotations

from pathlib import Path
from typing import Any

import isaaclab.sim as sim_utils
Expand Down Expand Up @@ -200,6 +203,52 @@ def get_viewer_cfg(self) -> ViewerCfg:
return ViewerCfg(eye=(2.75, -5.5, 1.5), lookat=(2.75, -1.4, 0.9))


_REPLICATOR_ROOT = Path(__file__).resolve().parents[2] / "Replicator"


def _discover_replicator_kitchen_usda_paths() -> dict[str, Path]:
"""Map ``replicator_<stem>`` registry names to flat ``Replicator/*.usda`` paths."""
paths: dict[str, Path] = {}
if not _REPLICATOR_ROOT.is_dir():
return paths
for usda_path in sorted(_REPLICATOR_ROOT.glob("*.usda")):
asset_name = f"replicator_{usda_path.stem}"
paths[asset_name] = usda_path.resolve()
return paths


class ReplicatorKitchenBackground(LibraryBackground):
"""Lightwheel Replicator-generated kitchen floorplan from a flat ``Replicator/*.usda`` file."""

tags = ["background", "replicator"]
initial_pose = Pose.identity()
object_min_z = -0.2

def get_viewer_cfg(self) -> ViewerCfg:
return ViewerCfg(eye=(0.0, -1.0, 1.35), lookat=(0.0, 0.0, 1.35))


def _register_replicator_kitchen_background(asset_name: str, usda_path: Path) -> None:
"""Register one ``replicator_<stem>`` background asset class."""
slug = asset_name.removeprefix("replicator_")
class_suffix = "".join(word.capitalize() for word in slug.split("_"))

@register_asset
class _ReplicatorKitchenEntry(ReplicatorKitchenBackground):
name = asset_name
usd_path = str(usda_path)

def __init__(self, **kwargs):
super().__init__(**kwargs)

_ReplicatorKitchenEntry.__name__ = f"Replicator{class_suffix}"
_ReplicatorKitchenEntry.__qualname__ = _ReplicatorKitchenEntry.__name__


for _asset_name, _usda_path in _discover_replicator_kitchen_usda_paths().items():
_register_replicator_kitchen_background(_asset_name, _usda_path)


@register_asset
class MapleTableRobolab(LibraryBackground):
"""
Expand Down
25 changes: 25 additions & 0 deletions isaaclab_arena/tests/test_replicator_background_discovery.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (c) 2026, The Isaac Lab Arena Project Developers (https://github.com/isaac-sim/IsaacLab-Arena/blob/main/CONTRIBUTORS.md).
# All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0


def test_discover_replicator_kitchen_usda_paths_finds_flat_usda_files():
from isaaclab_arena.assets.background_library import _discover_replicator_kitchen_usda_paths

paths = _discover_replicator_kitchen_usda_paths()
assert paths["replicator_kitchen_l_shape"].name == "kitchen_l_shape.usda"
assert all(path.parent.name == "Replicator" for path in paths.values())
replicator_dir = paths["replicator_kitchen_l_shape"].parent
assert len(paths) == len(list(replicator_dir.glob("*.usda")))


def test_replicator_kitchen_backgrounds_registered():
from isaaclab_arena.assets.registries import AssetRegistry, ensure_assets_registered

ensure_assets_registered()
registry = AssetRegistry()
assert registry.is_registered("replicator_kitchen_l_shape")
cls = registry.get_asset_by_name("replicator_kitchen_l_shape")
assert "replicator" in cls.tags
assert cls.usd_path.endswith("kitchen_l_shape.usda")
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Copyright (c) 2026, The Isaac Lab Arena Project Developers (https://github.com/isaac-sim/IsaacLab-Arena/blob/main/CONTRIBUTORS.md).
# All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

env_name: droid_banana_to_bowl_kitchen_g_shape
embodiment:
id: droid
registry_name: droid_abs_joint_pos
params:
stand_height_m: 0.8
placement_bbox_stand_only: true
background:
id: kitchen
registry_name: replicator_kitchen_g_shape
params:
collision_mode: mesh
objects:
- id: banana
registry_name: banana_ycb_robolab
params: {}
- id: bowl
registry_name: bowl_ycb_robolab
params: {}
object_references:
- id: floor
parent_id: kitchen
prim_path: KitchenRoom/Floor
object_type: base
params: {}
- id: corner_counter
parent_id: kitchen
prim_path: CornerCounter_00_0
object_type: base
params: {}
relations:
- kind: is_anchor
subject: floor
params: {}
- kind: is_anchor
subject: corner_counter
params: {}
- kind: 'on'
subject: droid
reference: floor
params: {}
- kind: next_to
subject: droid
reference: corner_counter
params:
side: negative_y
distance_m: 0.15
tolerance_m: 0.15
- kind: rotate_around_solution
subject: droid
params:
yaw_rad: 1.57
- kind: 'on'
subject: banana
reference: corner_counter
params: {}
- kind: 'on'
subject: bowl
reference: corner_counter
params: {}
task:
composition: atomic
description: pick up the banana from the corner counter and place it in the bowl
subtasks:
- kind: PickAndPlaceTask
params:
pick_up_object: banana
destination_location: bowl
background_scene: kitchen
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Copyright (c) 2026, The Isaac Lab Arena Project Developers (https://github.com/isaac-sim/IsaacLab-Arena/blob/main/CONTRIBUTORS.md).
# All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

env_name: droid_bowl_to_sink_kitchen_g_shape
embodiment:
id: droid
registry_name: droid_abs_joint_pos
params:
stand_height_m: 0.8
placement_bbox_stand_only: true
background:
id: kitchen
registry_name: replicator_kitchen_g_shape
params:
collision_mode: mesh
objects:
- id: bowl
registry_name: bowl_ycb_robolab
params: {}
object_references:
- id: floor
parent_id: kitchen
prim_path: KitchenRoom/Floor
object_type: base
params: {}
- id: sink
parent_id: kitchen
prim_path: Sink/BasinBottom
object_type: base
params: {}
- id: sink_counter
parent_id: kitchen
prim_path: CapSurface_02
object_type: base
params: {}
relations:
- kind: is_anchor
subject: floor
params: {}
- kind: is_anchor
subject: sink
params: {}
- kind: is_anchor
subject: sink_counter
params: {}
- kind: 'on'
subject: droid
reference: floor
params: {}
- kind: next_to
subject: droid
reference: sink
params:
side: negative_x
distance_m: 0.15
tolerance_m: 0.15
- kind: rotate_around_solution
subject: droid
params:
yaw_rad: 0.0
- kind: 'on'
subject: bowl
reference: sink_counter
params: {}
- kind: next_to
subject: bowl
reference: sink
params:
side: positive_y
distance_m: 0.1
task:
composition: atomic
description: pick up the bowl from the sink counter and place it in the sink
subtasks:
- kind: PickAndPlaceTask
params:
pick_up_object: bowl
destination_location: sink
background_scene: kitchen
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Copyright (c) 2026, The Isaac Lab Arena Project Developers (https://github.com/isaac-sim/IsaacLab-Arena/blob/main/CONTRIBUTORS.md).
# All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

env_name: droid_mustard_to_bowl_kitchen_g_shape
embodiment:
id: droid
registry_name: droid_abs_joint_pos
params:
stand_height_m: 0.8
placement_bbox_stand_only: true
background:
id: kitchen
registry_name: replicator_kitchen_g_shape
params:
collision_mode: mesh
objects:
- id: mustard_bottle
registry_name: mustard_bottle_hope_robolab
params: {}
- id: bowl
registry_name: bowl_ycb_robolab
params: {}
object_references:
- id: floor
parent_id: kitchen
prim_path: KitchenRoom/Floor
object_type: base
params: {}
- id: island_top
parent_id: kitchen
prim_path: CapSurface_03
object_type: base
params: {}
relations:
- kind: is_anchor
subject: floor
params: {}
- kind: is_anchor
subject: island_top
params: {}
- kind: 'on'
subject: droid
reference: floor
params: {}
- kind: next_to
subject: droid
reference: island_top
params:
side: positive_y
distance_m: 0.15
tolerance_m: 0.15
- kind: rotate_around_solution
subject: droid
params:
yaw_rad: -1.57
- kind: 'on'
subject: mustard_bottle
reference: island_top
params: {}
- kind: 'on'
subject: bowl
reference: island_top
params: {}
task:
composition: atomic
description: pick up the mustard bottle from the kitchen island and place it in the bowl
subtasks:
- kind: PickAndPlaceTask
params:
pick_up_object: mustard_bottle
destination_location: bowl
background_scene: kitchen
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Copyright (c) 2026, The Isaac Lab Arena Project Developers (https://github.com/isaac-sim/IsaacLab-Arena/blob/main/CONTRIBUTORS.md).
# All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

env_name: droid_banana_to_bowl_kitchen_l_island
embodiment:
id: droid
registry_name: droid_abs_joint_pos
params:
stand_height_m: 0.8
placement_bbox_stand_only: true
background:
id: kitchen
registry_name: replicator_kitchen_l_island
params:
collision_mode: mesh
objects:
- id: banana
registry_name: banana_ycb_robolab
params: {}
- id: bowl
registry_name: bowl_ycb_robolab
params: {}
object_references:
- id: floor
parent_id: kitchen
prim_path: KitchenRoom/Floor
object_type: base
params: {}
- id: corner_counter
parent_id: kitchen
prim_path: CornerCounter_00_0
object_type: base
params: {}
relations:
- kind: is_anchor
subject: floor
params: {}
- kind: is_anchor
subject: corner_counter
params: {}
- kind: 'on'
subject: droid
reference: floor
params: {}
- kind: next_to
subject: droid
reference: corner_counter
params:
side: negative_y
distance_m: 0.15
tolerance_m: 0.15
- kind: rotate_around_solution
subject: droid
params:
yaw_rad: 1.57
- kind: 'on'
subject: banana
reference: corner_counter
params: {}
- kind: 'on'
subject: bowl
reference: corner_counter
params: {}
task:
composition: atomic
description: pick up the banana from the corner counter and place it in the bowl
subtasks:
- kind: PickAndPlaceTask
params:
pick_up_object: banana
destination_location: bowl
background_scene: kitchen
Loading
Loading