Implementation:ARISE Initiative Robosuite VisualizationWrapper
Metadata:
- robosuite
- Robotics_Simulation
- Teleoperation
- last_updated: 2026-02-15 12:00 GMT
Overview
Concrete wrapper for adding visual indicator sites to robosuite environments provided by the wrappers module.
Description
The `VisualizationWrapper` class wraps a `MujocoEnv` to add visual indicator sites (spheres or custom shapes) into the MuJoCo model. These indicators provide real-time visual feedback during teleoperation. Supports single default indicator, custom indicator configs, or multiple indicators.
The wrapper modifies the MuJoCo model XML at initialization time to inject visual geometry (sites) that can be dynamically positioned during runtime. This allows operators to see target positions, waypoints, or other spatial goals directly in the simulation rendering without cluttering the environment's core definition.
Usage
Wrap an environment when using teleoperation devices. Typically applied before DataCollectionWrapper in demo collection pipelines. The wrapper is transparent to the environment's core functionality and does not affect observation or action spaces.
Code Reference
Source: robosuite
File: robosuite/wrappers/visualization_wrapper.py
Lines: L23-186
Signature:
class VisualizationWrapper:
def __init__(self, env, indicator_configs=None):
"""
Args:
env (MujocoEnv): The environment to visualize
indicator_configs (None or str or dict or list): Configurations for visual indicators.
None = no indicators, 'default' = spherical indicator, dict = single config, list = multiple configs
"""
Import:
from robosuite.wrappers import VisualizationWrapper
I/O Contract
Inputs:
- env (MujocoEnv, Required): The base environment to wrap and augment with visual indicators
- indicator_configs (None/str/dict/list, Optional): Configuration specifying the visual indicators to add
- `None` - No indicators added
- `'default'` - Adds a default spherical indicator site
- `dict` - Single custom indicator configuration (position, size, color, shape)
- `list` - Multiple indicator configurations for multiple visual markers
Outputs:
- VisualizationWrapper instance: A wrapped environment that delegates all MujocoEnv methods (reset, step, render, etc.) and adds indicator sites to the MuJoCo model for visual feedback
Usage Examples
Example 1: Wrap with default indicator
import robosuite as suite
from robosuite.wrappers import VisualizationWrapper
# Create base environment
env = suite.make(
env_name="Lift",
robots="Panda",
has_renderer=True,
has_offscreen_renderer=False,
use_camera_obs=False,
)
# Wrap with default indicator
env = VisualizationWrapper(env, indicator_configs='default')
# Reset environment (indicator is now visible in rendering)
obs = env.reset()
# Update indicator position during teleoperation
target_position = [0.5, 0.0, 0.8]
env.sim.data.set_mocap_pos('indicator_default', target_position)
# Step through environment
for _ in range(100):
action = env.action_space.sample()
obs, reward, done, info = env.step(action)
env.render()
if done:
obs = env.reset()
Example 2: Wrap with custom indicator config
import robosuite as suite
from robosuite.wrappers import VisualizationWrapper
# Create base environment
env = suite.make(
env_name="PickPlace",
robots="Sawyer",
has_renderer=True,
has_offscreen_renderer=False,
use_camera_obs=False,
)
# Define custom indicator configuration
custom_indicator = {
'name': 'target_marker',
'pos': [0.6, 0.1, 0.9],
'size': [0.02, 0.02, 0.02],
'rgba': [1.0, 0.0, 0.0, 0.5], # Semi-transparent red
'type': 'sphere'
}
# Wrap with custom indicator
env = VisualizationWrapper(env, indicator_configs=custom_indicator)
# Reset and use
obs = env.reset()
# Multiple indicators example
multiple_indicators = [
{'name': 'waypoint1', 'pos': [0.5, 0.0, 0.8], 'rgba': [0.0, 1.0, 0.0, 0.5]},
{'name': 'waypoint2', 'pos': [0.6, 0.2, 0.8], 'rgba': [0.0, 0.0, 1.0, 0.5]},
{'name': 'goal', 'pos': [0.7, 0.0, 1.0], 'rgba': [1.0, 0.0, 0.0, 0.8]}
]
env_multi = suite.make("Stack", robots="Panda", has_renderer=True)
env_multi = VisualizationWrapper(env_multi, indicator_configs=multiple_indicators)