Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Haosulab ManiSkill ReplicaCADRearrangeSceneBuilder

From Leeroopedia
Knowledge Sources
Domains Robotics, Simulation, Scene_Building
Last Updated 2026-02-15 08:00 GMT

Overview

Concrete tool for building ReplicaCAD rearrangement task scenes in ManiSkill, extending the base ReplicaCAD scene builder with episode-based object placement and articulated object state management.

Description

ReplicaCADRearrangeSceneBuilder extends ReplicaCADSceneBuilder to support Habitat Rearrange-style tasks. It loads rearrangement episode configurations that specify YCB object locations, articulation states, and goal locations on top of the base ReplicaCAD scenes. The builder pre-builds multiple instances of each YCB object per parallel environment and manages their visibility by teleporting unused objects to hidden positions. It also tracks articulated object states (such as fridge open/close) per episode configuration. The builder supports sampling of both build configurations (which ReplicaCAD scene to use) and init configurations (which episode arrangement to apply), enabling efficient reuse of built scenes across different rearrangement episodes without rebuilding actors.

Key design decisions:

  • Instead of rebuilding YCB objects for each episode, multiple instances are pre-built and shown/hidden via pose changes for performance.
  • Hidden objects are placed at staggered positions starting at [-10000, -10000, -10000] to avoid collision interference.
  • Episode configs are grouped by which ReplicaCAD base scene they use.

Usage

Use this builder when creating rearrangement tasks (e.g., "set_table:train") that require placing YCB objects in ReplicaCAD scenes according to predefined episode configurations. It is the primary scene builder for Habitat-style rearrange benchmarks in ManiSkill.

Code Reference

Source Location

Signature

class ReplicaCADRearrangeSceneBuilder(ReplicaCADSceneBuilder):
    task_names: list[str] = ["set_table:train"]
    init_configs: list[list[dict[str, list[sapien.Pose]]]] = None

    def __init__(self, env): ...
    def build(self, build_config_idxs: list[int], init_config_names: Optional[list] = None): ...
    def initialize(self, env_idx: torch.Tensor, init_config_idxs: list[int]): ...
    def sample_build_config_idxs(self) -> list[int]: ...
    def sample_init_config_idxs(self) -> list[int]: ...
    def hide_actor(self, actor: Actor): ...
    def show_actor(self, actor: Actor, pose: sapien.Pose): ...
    @cached_property
    def init_config_names_to_idxs(self) -> int: ...

Import

from mani_skill.utils.scene_builder.replicacad.rearrange.scene_builder import ReplicaCADRearrangeSceneBuilder

I/O Contract

Method Input Output Description
build build_config_idxs: list[int], init_config_names: Optional[list] Populates self.init_configs, self.ycb_objs_per_env Builds base RCAD scenes and pre-creates YCB object instances per env
initialize env_idx: torch.Tensor, init_config_idxs: list[int] Sets poses of YCB objects and articulation qpos Initializes scenes with poses from sampled episode configs
sample_build_config_idxs None list[int] Randomly samples which ReplicaCAD scenes to use
sample_init_config_idxs None list[int] Randomly samples which episode config to use per env
hide_actor actor: Actor None Teleports actor to pre-assigned hidden position
show_actor actor: Actor, pose: sapien.Pose None Places actor at specified pose

Usage Examples

# Typical usage within an environment class
scene_builder = ReplicaCADRearrangeSceneBuilder(env)

# Build with specific scene indices
build_config_idxs = scene_builder.sample_build_config_idxs()
scene_builder.build(build_config_idxs)

# Initialize with specific episode configs
init_config_idxs = scene_builder.sample_init_config_idxs()
scene_builder.initialize(env_idx, init_config_idxs)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment