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:ARISE Initiative Robosuite Demo Sensor Corruption

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

Overview

Concrete tool for demonstrating sensor corruption and delay using robosuite's Observable system provided by robosuite.

Description

The demo_sensor_corruption.py script is a demonstration program that showcases how to use robosuite's Observable functionality to simulate corrupted and delayed sensor readings. It implements Gaussian noise corruption and uniform-sampled delay on both camera image observations and proprioceptive (joint position) observations, providing a realistic simulation of noisy sensor conditions that robots encounter in the real world.

The script creates a robosuite environment (any environment can be specified via command-line arguments) and wraps it with a VisualizationWrapper. It then modifies observable attributes at runtime using env.modify_observable() to inject noise corrupters and delay functions. For camera images, Gaussian noise with configurable standard deviation is added and frames are delayed by a configurable average time (uniformly sampled around that average). For proprioception (joint positions), noise is scaled relative to each joint's range divided by 50, and delay is set to half the image delay.

A key feature is the creation of a "ground truth" delayed proprioception observable that tracks the exact same delay as the corrupted one but without noise. This allows real-time comparison between the corrupted observations and the actual delayed ground truth, making it easy to quantify the corruption magnitude. The script also supports toggling corruption on and off via a gripper action command, allowing users to compare teleoperation experience with and without sensor corruption.

The demonstration supports keyboard, SpaceMouse, and DualSense input devices for teleoperation and renders camera images via OpenCV (cv2). It prints real-time statistics showing the observed joint positions, the corruption values, and the current delay amount.

Usage

Use this script as a reference for implementing sensor noise models in robosuite experiments. It demonstrates the pattern for creating custom corrupters and delayers, adding new observables at runtime, and modifying observable properties dynamically. This is particularly useful for sim-to-real transfer research where modeling sensor noise is critical.

Code Reference

Source Location

Signature

# This is a standalone script, not a class.
# Key functions used:

# Create corrupter and delayer
image_corrupter = create_gaussian_noise_corrupter(mean=0.0, std=args.corruption, low=0, high=255)
image_delayer = create_uniform_sampled_delayer(
    min_delay=max(0, args.delay - 0.025),
    max_delay=args.delay + 0.025
)

# Modify an observable's attributes at runtime
env.modify_observable(
    observable_name=obs_name,
    attribute=attr,
    modifier=mod,
)

# Add a new observable at runtime
env.add_observable(observable)

Import

# Key imports used in the script
import robosuite as suite
from robosuite.utils.observables import Observable, create_gaussian_noise_corrupter, create_uniform_sampled_delayer
from robosuite.wrappers import VisualizationWrapper

I/O Contract

Inputs

Name Type Required Description
--environment str No Name of the robosuite environment to use. Default: "Lift"
--robots str (nargs+) No Robot(s) to use. Default: "Panda"
--delay float No Average delay in seconds to apply to observations. Default: 0.04
--corruption float No Standard deviation of Gaussian noise for image corruption. Default: 20.0
--device str No Input device: "keyboard", "spacemouse", or "dualsense". Default: "keyboard"
--camera str No Name of camera to render. Default: "agentview"
--width int No Camera render width. Default: 512
--height int No Camera render height. Default: 384
--toggle-corruption-on-grasp flag No If set, toggles corruption on/off with gripper action
--switch-on-grasp flag No If set, switches gripper control on gripper action

Outputs

Name Type Description
Rendered image np.array (H, W, 3) Corrupted and delayed camera image displayed via OpenCV
Console output str Per-step print of observed joint positions, corruption values, and delay
{camera}_image np.array Corrupted and delayed image observation in the obs dict
{prefix}joint_pos np.array Corrupted and delayed joint position observation
{prefix}joint_pos_ground_truth np.array Delayed (but uncorrupted) joint position observation for comparison

Usage Examples

# Run from the command line:
# python robosuite/demos/demo_sensor_corruption.py --environment Stack --robots Panda --delay 0.05 --corruption 5.0

# Or use the key patterns from the script in your own code:
import robosuite as suite
from robosuite.utils.observables import (
    Observable,
    create_gaussian_noise_corrupter,
    create_uniform_sampled_delayer,
)
from robosuite.wrappers import VisualizationWrapper

# Create environment
env = suite.make(
    env_name="Lift",
    robots="Panda",
    has_renderer=False,
    has_offscreen_renderer=True,
    use_camera_obs=True,
    use_object_obs=True,
    camera_names="agentview",
    camera_heights=256,
    camera_widths=256,
)

# Wrap for visualization
env = VisualizationWrapper(env, indicator_configs=None)

# Add image corruption
corrupter = create_gaussian_noise_corrupter(mean=0.0, std=10.0, low=0, high=255)
delayer = create_uniform_sampled_delayer(min_delay=0.02, max_delay=0.06)

env.modify_observable(
    observable_name="agentview_image",
    attribute="corrupter",
    modifier=corrupter,
)
env.modify_observable(
    observable_name="agentview_image",
    attribute="delayer",
    modifier=delayer,
)

obs = env.reset()
# obs["agentview_image"] will now contain corrupted and delayed images

Related Pages

Page Connections

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