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 LeggedRobot

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

Overview

The LeggedRobot class extends MobileRobot to implement robots with legged locomotion bases, adding leg joint controller loading, leg actuator references, and support for actuator gear ratios during control.

Description

LeggedRobot is a concrete subclass of MobileRobot designed for humanoid or multi-legged robots that use leg joints for locomotion rather than wheels. It introduces the _load_leg_controllers method which configures controller parameters (joint indexes, actuator ranges, policy frequency) for the legs body part, reading joint and actuator references from the robot model's legs_joints and legs_actuators attributes.

The _load_controller method orchestrates the full controller setup: it creates the composite controller, loads arm controllers, base controllers, optionally leg controllers (if legs are actuated), head controllers, and torso controllers, then post-processes and loads the final configuration. The setup_references method extends the parent to register leg actuator and joint indexes, as well as leg joint position and velocity address indexes.

A key difference from WheeledRobot is in the control method: LeggedRobot divides applied actions by actuator gear ratios before clipping and applying them to the simulation, which accounts for the mechanical advantage of leg actuators. The reset method additionally sets the initial joint positions for the legged base from the base model's init_qpos when the base is a LegBaseModel instance.

Usage

Use this class for robots with leg-based locomotion (e.g., humanoid robots). It is instantiated by the environment when a legged robot type is specified in the robot configuration.

Code Reference

Source Location

Signature

class LeggedRobot(MobileRobot):
    def __init__(
        self,
        robot_type: str,
        idn=0,
        composite_controller_config=None,
        initial_qpos=None,
        initialization_noise=None,
        base_type="default",
        gripper_type="default",
        control_freq=20,
        lite_physics=True,
    ): ...

    def _load_leg_controllers(self): ...
    def _load_controller(self): ...
    def reset(self, deterministic=False, rng=None): ...
    def setup_references(self): ...
    def control(self, action, policy_step=False): ...

Import

from robosuite.robots.legged_robot import LeggedRobot

I/O Contract

Inputs

Name Type Required Description
robot_type str Yes Name of the legged robot type to instantiate
idn int or str No Unique identifier for this robot
composite_controller_config dict or None No Controller configuration dictionary
initial_qpos sequence of float or None No Initial arm joint positions
initialization_noise dict or None No Joint initialization noise parameters
base_type str No Type of legged base model (default: "default")
gripper_type str or None No Type of gripper (default: "default")
control_freq float No Control frequency in Hz (default: 20)
lite_physics bool No Use lite physics mode (default: True)

Outputs

Name Type Description
action_limits tuple(np.array, np.array) (low, high) action limits from composite controller
is_legs_actuated bool Whether the robot has actuated leg joints (property)
num_leg_joints int Number of leg joints in the robot model (property)

Usage Examples

import robosuite as suite
import numpy as np

# Create an environment with a legged robot (e.g., GR1)
env = suite.make(
    "Lift",
    robots="GR1",
    control_freq=20,
)

robot = env.robots[0]

# The robot is mobile with leg locomotion
assert robot.is_mobile == True

# Check leg properties
print(f"Legs actuated: {robot.is_legs_actuated}")
print(f"Number of leg joints: {robot.num_leg_joints}")

# Step with a zero action
action = np.zeros(robot.action_dim)
obs, reward, done, info = env.step(action)

Related Pages

Page Connections

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