Implementation:Haosulab ManiSkill AI2THORSceneBuilder
| Knowledge Sources | |
|---|---|
| Domains | Robotics, Simulation, Scene_Building |
| Last Updated | 2026-02-15 08:00 GMT |
Overview
Concrete tool for building AI2-THOR scenes in ManiSkill, using configurations and assets from the ai2thor-hab HuggingFace dataset to create indoor environments with static and dynamic objects.
Description
AI2THORBaseSceneBuilder extends SceneBuilder to load and construct scenes from AI2-THOR datasets (including ProcTHOR procedurally generated scenes). It reads scene instance JSON files that describe background stages, object placements, rotations, and motion types.
Key implementation details:
- Loads scene configurations from a metadata JSON file (e.g.,
ProcTHOR.json) containing paths to individual scene instance files. - Applies a 90-degree rotation around the x-axis to convert from AI2-THOR's coordinate system to SAPIEN/ManiSkill conventions. ProcTHOR scenes additionally rotate around the y-axis.
- Distinguishes between static objects (built as static actors with non-convex collision) and movable objects. Only objects whose names match
WORKING_OBJS(apple, potato, tomato, lettuce, soap, sponge, plate, book) are built as dynamic actors. - Uses
_should_be_static()to check object semantic IDs against a movable object mapping loaded from metadata. - Configures collision groups to prevent the Fetch robot's wheels from colliding with the scene background.
- Provides per-scene robot start positions via
FETCH_BUILD_CONFIG_IDX_TO_START_POSmapping. - Caches navigable positions from precomputed numpy files for path planning.
The builder creates a merged background actor from individual background objects across parallel environments.
Usage
Use this builder for tasks that require AI2-THOR indoor environments in ManiSkill. Subclass it and set the scene_dataset class attribute to specify which AI2-THOR dataset to use (e.g., "ProcTHOR").
Code Reference
Source Location
- Repository: Haosulab_ManiSkill
- File: mani_skill/utils/scene_builder/ai2thor/scene_builder.py
Signature
WORKING_OBJS = ["apple", "potato", "tomato", "lettuce", "soap", "sponge", "plate", "book"]
FETCH_BUILD_CONFIG_IDX_TO_START_POS = {
0: (-3, 0), 1: (-2, -2), 2: (0, 0), 3: (-3.5, 0),
4: (0, -2), 5: (-1, 1.5), 6: (1, -0.5), 7: (3.25, 1),
8: (1, 2), 9: (1, 1),
}
class AI2THORBaseSceneBuilder(SceneBuilder):
scene_dataset: str
def __init__(self, env, robot_init_qpos_noise=0.02): ...
def _should_be_static(self, template_name: str) -> bool: ...
def build(self, build_config_idxs: Union[int, list[int]], convex_decomposition="none"): ...
def initialize(self, env_idx): ...
def disable_fetch_move_collisions(self, actor: Actor, disable_base_collisions=False): ...
@property
def navigable_positions(self) -> list[np.ndarray]: ...
Import
from mani_skill.utils.scene_builder.ai2thor.scene_builder import AI2THORBaseSceneBuilder
I/O Contract
| Method | Input | Output | Description |
|---|---|---|---|
build |
build_config_idxs, convex_decomposition |
Populated scene_objects, movable_objects, bg |
Builds stage background and all objects from scene JSON |
initialize |
env_idx |
None | Resets Fetch robot position and all object poses |
_should_be_static |
template_name: str |
bool |
Checks if object should be static based on semantic ID |
Usage Examples
# Subclass for ProcTHOR scenes
class ProcTHORSceneBuilder(AI2THORBaseSceneBuilder):
scene_dataset = "ProcTHOR"
# Usage
scene_builder = ProcTHORSceneBuilder(env)
scene_builder.build(build_config_idxs=[0] * env.num_envs)
scene_builder.initialize(env_idx=torch.arange(env.num_envs))
# Access navigable positions
nav = scene_builder.navigable_positions