Implementation:ARISE Initiative Robosuite LegBaseModel
| Knowledge Sources | |
|---|---|
| Domains | Robotics, Simulation, MJCF_Modeling |
| Last Updated | 2026-02-15 07:00 GMT |
Overview
LegBaseModel is the abstract base class for all mobile leg base models in robosuite, providing methods for converting robot bases into floating (mobile) configurations.
Description
The LegBaseModel class extends RobotBaseModel to define the interface and common functionality for legged robot bases. It provides core methods for manipulating the MJCF XML model of a leg base, including removing joint actuation for specific body parts, removing free joints, and programmatically adding mobile joints (forward, side, and yaw) that convert a stationary leg base into a floating mobile platform.
The _add_mobile_joint method is particularly notable, as it dynamically creates three joints (forward slide, side slide, and yaw hinge) along with corresponding velocity actuators. These joints enable planar motion with configurable friction loss (250 N) and force limits (600 N). The yaw actuator has a higher velocity gain (kv=1500) compared to the translational actuators (kv=1000) and a wider control range of [-1.5, 1.5] versus [-1.0, 1.0] for the slide joints.
The _remove_joint_actuation method provides a way to strip joints, motors, and associated sensors (position, velocity, actuator force) from specific body parts by name matching. This is useful when certain parts of the leg base model need to be fixed or simplified. The naming prefix follows the pattern leg{idn}_ for proper namespace isolation in multi-robot scenarios.
Usage
Use LegBaseModel as a base class when implementing new legged robot base models. Subclasses must implement the init_qpos property to define the default joint positions. The default_base property returns "NullMobileBase", indicating that by default no mobile base is attached.
Code Reference
Source Location
- Repository: ARISE_Initiative_Robosuite
- File: robosuite/models/bases/leg_base_model.py
Signature
class LegBaseModel(RobotBaseModel):
# Inherits __init__ from RobotBaseModel
# def __init__(self, fname: str, idn=0):
Import
from robosuite.models.bases.leg_base_model import LegBaseModel
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| fname | str | Yes | Path to relevant XML file to create this leg base instance (inherited from RobotBaseModel) |
| idn | int or str | No | Unique identification number or string for this base instance. Default: 0 |
Outputs
| Name | Type | Description |
|---|---|---|
| LegBaseModel instance | LegBaseModel | Abstract leg base model with mobile joint support |
| naming_prefix | str | Returns "leg{idn}_" prefix for namespace isolation
|
| default_base | str | Returns "NullMobileBase"
|
| init_qpos | np.array | Default joint positions (must be defined by subclasses) |
Usage Examples
from robosuite.models.bases.leg_base_model import LegBaseModel
# LegBaseModel is abstract; typically used via a concrete subclass.
# Example subclass usage pattern:
class MyLegBase(LegBaseModel):
@property
def init_qpos(self):
return np.zeros(6)
@property
def naming_prefix(self):
return "leg{}_".format(self.idn)
@property
def top_offset(self):
return np.array([0, 0, 0.5])
@property
def horizontal_radius(self):
return 0.3
# Programmatically add mobile joints to make the leg base floating
# leg_base._add_mobile_joint()
# Remove actuation from a specific part
# leg_base._remove_joint_actuation("knee")