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

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

Overview

Concrete tool for defining the abstract base interface for all mobile base controllers provided by robosuite.

Description

The MobileBaseController class is the abstract base class for all mobile base controllers in the robosuite framework. It provides the foundational interface and shared state management for controlling a robot's mobile base (locomotion platform). The class uses Python's abc.ABCMeta metaclass to enforce implementation of the run_controller() method in subclasses.

At initialization, the controller stores references to the MuJoCo simulator, joint index mappings, and actuator range limits. It manages joint state (position and velocity), the base pose (position and orientation matrix), and initial pose references used for coordinate frame transformations. The get_base_pose() method retrieves the current base position and orientation from the MuJoCo site data using the robot's center site (identified by the naming prefix).

The class provides the same utility methods as the arm controller base: scale_action() for input-output mapping, clip_torques() for enforcing limits, nums2array() for flexible parameter handling, and properties for gravity compensation, actuator limits, and control limits. A reset() method stores the current base pose as the initial reference, which is used by subclass controllers for relative coordinate transformations. Unlike the arm Controller, this class does not track end-effector pose, Jacobians, or mass matrices.

Usage

Use the MobileBaseController as the parent class when implementing new mobile base control strategies in robosuite. It should not be instantiated directly. The primary concrete subclass is MobileBaseJointVelocityController, which implements velocity-level base control.

Code Reference

Source Location

Signature

class MobileBaseController(object, metaclass=abc.ABCMeta):
    def __init__(
        self,
        sim,
        joint_indexes,
        actuator_range,
        naming_prefix=None,
    ): ...

    def get_base_pose(self) -> tuple: ...
    def reset(self): ...

    @abc.abstractmethod
    def run_controller(self): ...

    def scale_action(self, action) -> np.array: ...
    def update(self, force=False): ...
    def update_initial_joints(self, initial_joints): ...
    def clip_torques(self, torques) -> np.array: ...
    def reset_goal(self): ...

    @staticmethod
    def nums2array(nums, dim) -> np.array: ...

    @property
    def torque_compensation(self) -> np.array: ...

    @property
    def actuator_limits(self) -> tuple: ...

    @property
    def control_limits(self) -> tuple: ...

    @property
    def name(self) -> str: ...

Import

from robosuite.controllers.parts.mobile_base.mobile_base_controller import MobileBaseController

I/O Contract

Inputs

Name Type Required Description
sim MjSim Yes MuJoCo simulator instance for pulling robot state
joint_indexes dict Yes Dictionary with keys 'joints', 'qpos', 'qvel' containing index lists for the base joints
actuator_range 2-tuple of array Yes (low, high) arrays defining actuator command limits
naming_prefix str No Prefix for multi-robot naming (used to locate the center site, e.g., "robot0_")

Outputs

Name Type Description
torques np.array Torques or velocity commands computed by the subclass controller
joint_pos np.array Current base joint positions
joint_vel np.array Current base joint velocities
base_pos np.array Current base position in world frame (from get_base_pose())
base_ori_mat np.array Current base orientation as 3x3 rotation matrix (from get_base_pose())
torque_compensation np.array Gravity compensation torques from MuJoCo bias forces
actuator_limits tuple(np.array, np.array) (min, max) actuator command limits
control_limits tuple(np.array, np.array) (min, max) action input limits

Usage Examples

# The MobileBaseController is abstract and cannot be instantiated directly.
# Use the MobileBaseJointVelocityController subclass instead:

from robosuite.controllers.parts.mobile_base.mobile_base_controller import MobileBaseController
import numpy as np
import abc

class MyBaseController(MobileBaseController):
    def __init__(self, sim, joint_indexes, actuator_range, **kwargs):
        super().__init__(
            sim=sim,
            joint_indexes=joint_indexes,
            actuator_range=actuator_range,
            naming_prefix=kwargs.get("naming_prefix", None),
        )
        self.control_dim = len(joint_indexes["joints"])
        self.input_max = np.ones(self.control_dim)
        self.input_min = -np.ones(self.control_dim)
        self.output_max = np.ones(self.control_dim)
        self.output_min = -np.ones(self.control_dim)

    def set_goal(self, action):
        self.update()
        self.goal = self.scale_action(action)

    def run_controller(self):
        self.update()
        # Custom base control logic here
        vels = np.zeros(self.control_dim)
        super().run_controller()
        return vels

    def reset_goal(self):
        pass

    @property
    def name(self):
        return "MY_BASE"

# Or use the built-in controller via the factory:
from robosuite.controllers.parts.controller_factory import mobile_base_controller_factory

params = {
    "sim": sim,
    "joint_indexes": {"joints": [0, 1, 2], "qpos": [0, 1, 2], "qvel": [0, 1, 2]},
    "actuator_range": (np.array([-1, -1, -1]), np.array([1, 1, 1])),
    "naming_prefix": "robot0_",
}
base_controller = mobile_base_controller_factory("JOINT_VELOCITY", params)

Related Pages

Page Connections

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