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 Arena Base

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

Overview

Arena is the base class for all simulation arenas (workspaces) in robosuite, extending MujocoXML with floor management, camera configuration, mocap body setup for teleoperation, and object scaling support.

Description

The Arena class extends MujocoXML to provide a standardized workspace abstraction. On initialization, it loads an arena XML file and finds a reference to the floor geom. It then creates two mocap bodies -- left_eef_target and right_eef_target -- each containing a semi-transparent box geom and a small sphere geom. These mocap bodies are placed at (0, 0, -1) (below the scene) and are used as interactive control targets in the MjViewer UI for robot end-effector teleoperation. The mocap bodies use rendering group 2 and have zero contact affinity/type so they do not participate in physics.

After creating the mocap bodies, the arena runs _postprocess_arena() (a hook for subclasses to add custom elements like tables) and then recolors all collision geoms with ENVIRONMENT_COLLISION_COLOR, explicitly excluding the floor geom from recoloring.

The set_origin() method applies a constant (x, y, z) offset to all positioned elements in the worldbody, enabling arenas to be placed at arbitrary locations. The set_camera() method either creates a new camera or updates an existing one with specified position, quaternion, and optional additional attributes. The set_scale() method scales all geoms, meshes, sites, and bodies under a named body element, using the centralized scale_mjcf_model() utility, and records the applied scale in self.object_scales.

Usage

Use Arena as the base class for all workspace environments. Subclass it and override _postprocess_arena() to add workspace-specific elements (tables, bins, fixtures). Use set_origin() to position the arena in a multi-arena setup. Use set_camera() to configure task-specific camera viewpoints.

Code Reference

Source Location

Signature

class Arena(MujocoXML):
    def __init__(self, fname)

Import

from robosuite.models.arenas.arena import Arena
# Or via the package:
from robosuite.models.arenas import Arena

I/O Contract

Inputs

Name Type Required Description
fname str Yes Path to the arena MJCF XML file

Outputs

Name Type Description
floor ET.Element Reference to the floor geom element in the worldbody
bottom_pos np.array (x, y, z) position of the arena bottom. Initialized to [0, 0, 0]
object_scales dict Dictionary mapping body names to their applied scale factors

Key Methods

Method Description
set_origin(offset) Applies a constant (x,y,z) offset to all positioned elements in the worldbody
set_camera(camera_name, pos, quat, camera_attribs) Creates or updates a camera with specified position, quaternion, and optional extra attributes
set_scale(scale, obj_name) Scales all geoms, meshes, sites, and bodies under the named body. Raises ValueError if body not found.
_postprocess_arena() Hook for subclass post-processing (e.g., adding tables). Default is a no-op.

Usage Examples

from robosuite.models.arenas import Arena
from robosuite.utils.mjcf_utils import xml_path_completion
import numpy as np

# Create a custom arena subclass
class MyArena(Arena):
    def __init__(self):
        super().__init__(xml_path_completion("arenas/empty_arena.xml"))

    def _postprocess_arena(self):
        # Add custom elements during initialization
        pass

arena = MyArena()

# Move the arena origin
arena.set_origin([1.0, 0.0, 0.0])

# Add a camera for task observation
arena.set_camera(
    camera_name="frontview",
    pos=np.array([1.6, 0.0, 1.45]),
    quat=np.array([0.56, 0.43, 0.13, 0.70]),
)

# Scale an object within the arena
arena.set_scale(scale=1.5, obj_name="table")

Related Pages

Page Connections

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