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 RobotBaseModel

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

Overview

RobotBaseModel is the abstract base class for all mount and robot base models in robosuite, defining the interface for physical bases that are attached to robot root bodies.

Description

The RobotBaseModel class extends MujocoXMLModel to provide the foundational interface for mounts and bases that attach directly to robot root bodies. Upon initialization, it parses the XML file and extracts the rotation offset quaternion from the worldbody's first child element, converting it from (w, x, y, z) to (x, y, z, w) format for internal use.

The class defines several abstract properties that subclasses must implement: naming_prefix for namespace isolation, top_offset for the vector from the root body to the mounting surface, and horizontal_radius for the maximum radial extent of the model. These properties are essential for correctly placing robots in the simulation without initial collision forces.

Default implementations are provided for _important_sites, _important_geoms, and _important_sensors, all returning empty dictionaries. The contact_geom_rgba property returns the standard mount collision color constant from MJCF utilities. This base class serves as the parent for both stationary mounts and mobile bases (via LegBaseModel).

Usage

Use RobotBaseModel as the base class when creating new mount or robot base models. All subclasses must define naming_prefix, top_offset, and horizontal_radius. The model's root body will be directly appended to a robot's root body, so all positional offsets in the XML should be relative to the robot's root.

Code Reference

Source Location

Signature

class RobotBaseModel(MujocoXMLModel):
    def __init__(self, fname: str, idn=0):

Import

from robosuite.models.bases.robot_base_model import RobotBaseModel

I/O Contract

Inputs

Name Type Required Description
fname str Yes Path to relevant XML file to create this mount instance
idn int or str No Unique identification number or string for this base instance. Default: 0

Outputs

Name Type Description
RobotBaseModel instance RobotBaseModel Abstract base model with rotation offset parsed from XML
rotation_offset np.array Quaternion rotation offset in (x, y, z, w) format extracted from the worldbody
top_offset np.array (dx, dy, dz) vector from root body to mounting surface (abstract, must be implemented)
horizontal_radius float Maximum radial distance from root body (abstract, must be implemented)
contact_geom_rgba np.array RGBA color for collision geometry visualization

Usage Examples

from robosuite.models.bases.robot_base_model import RobotBaseModel

# RobotBaseModel is abstract; used via concrete subclasses.
# Example subclass:
class MyMount(RobotBaseModel):
    @property
    def naming_prefix(self):
        return "mount{}_".format(self.idn)

    @property
    def top_offset(self):
        return np.array([0, 0, 0.1])

    @property
    def horizontal_radius(self):
        return 0.2

# mount = MyMount("path/to/mount.xml", idn=0)
# print(mount.rotation_offset)  # quaternion offset from XML

Related Pages

Page Connections

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