Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:ARISE Initiative Robosuite USING INSTANCE RANDOMIZATION

From Leeroopedia

Metadata:

Overview

Global boolean flag for enabling instance-level geom group randomization provided by the robosuite macros module.

Description

macros.USING_INSTANCE_RANDOMIZATION is a module-level boolean variable that controls geom group assignment during model loading. Default is False. When set to True before environment creation, enables per-instance (rather than per-geom) randomization groups. This is a Pattern Doc - it documents a configuration pattern, not a function/class API.

Usage

Set to True at the top of scripts before any robosuite.make() calls when using domain randomization.

Code Reference

Source: robosuite

File: robosuite/macros.py

Line: L16

Pattern:

# Must be set BEFORE environment creation
import robosuite.macros as macros
macros.USING_INSTANCE_RANDOMIZATION = True

Import: import robosuite.macros as macros

I/O Contract

Inputs: Boolean value assignment (True/False)

Outputs: Affects geom group assignment in subsequent environment creation. No return value.

Usage Examples

Complete domain randomization setup showing flag configuration, environment creation, and wrapper application:

import robosuite as suite
import robosuite.macros as macros
from robosuite.wrappers import DomainRandomizationWrapper

# Step 1: Set the flag BEFORE environment creation
macros.USING_INSTANCE_RANDOMIZATION = True

# Step 2: Create the environment
env = suite.make(
    env_name="Lift",
    robots="Panda",
    has_renderer=False,
    has_offscreen_renderer=True,
    use_camera_obs=True,
)

# Step 3: Wrap with domain randomization
randomization_config = {
    "texture": True,
    "camera": True,
    "lighting": True,
}
env = DomainRandomizationWrapper(env, randomization_config)

# Now the environment will use instance-level randomization
obs = env.reset()

Related Pages

Page Connections

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