Implementation:Haosulab ManiSkill Hopper
| Knowledge Sources | |
|---|---|
| Domains | Robotics, Simulation, Control |
| Last Updated | 2026-02-15 08:00 GMT |
Overview
Concrete implementation of the Hopper locomotion control task environment in ManiSkill, adapted from the DeepMind Control Suite.
Description
The Hopper environment implements a planar one-legged hopping robot that must learn to stand or hop. The robot is defined inline via MJCF as HopperRobot with joints for hip, knee, and waist, plus planar tracking joints (rootx, rooty, rootz). It uses a PlanarSceneBuilder.
Registered variants:
MS-HopperStand-v1(max_episode_steps=200): Stand upright at a height of 0.6m.MS-HopperHop-v1(max_episode_steps=200): Hop forward at a target speed of 2 m/s while maintaining height.
Rewards are composed of standing reward (based on torso height) and hopping reward (based on forward speed). Constants: _STAND_HEIGHT=0.6, _HOP_SPEED=2. Reward modes include "dense", "normalized_dense", and "none".
Usage
Use this environment for benchmarking locomotion control algorithms on a simpler one-legged robot. The standing variant tests balance while the hopping variant tests dynamic locomotion.
Code Reference
Source Location
- Repository: Haosulab_ManiSkill
- File: mani_skill/envs/tasks/control/hopper.py
Signature
@register_env("MS-HopperStand-v1", max_episode_steps=200)
class HopperStandEnv(HopperEnvBase): ...
@register_env("MS-HopperHop-v1", max_episode_steps=200)
class HopperHopEnv(HopperEnvBase): ...
Import
import gymnasium as gym
import mani_skill.envs
env = gym.make("MS-HopperStand-v1")
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| obs_mode | str | No | Observation mode (default: "state") |
| reward_mode | str | No | Reward mode: "dense", "normalized_dense", "none" |
| control_mode | str | No | Control mode for the hopper joints |
Outputs
| Name | Type | Description |
|---|---|---|
| obs | dict/array | Observation including joint angles, velocities, torso height |
| reward | float | Reward based on standing height and forward speed |
| terminated | bool | Whether episode ended |
| truncated | bool | Whether episode hit max steps (200) |
| info | dict | Contains evaluation metrics |
Usage Examples
Basic Usage
import gymnasium as gym
import mani_skill.envs
env = gym.make("MS-HopperStand-v1", obs_mode="state", render_mode="rgb_array")
obs, info = env.reset()
for _ in range(100):
action = env.action_space.sample()
obs, reward, terminated, truncated, info = env.step(action)
if terminated or truncated:
obs, info = env.reset()
env.close()