Implementation:Haosulab ManiSkill QuadrupedSpin
| Knowledge Sources | |
|---|---|
| Domains | Robotics, Simulation, Locomotion |
| Last Updated | 2026-02-15 08:00 GMT |
Overview
Concrete implementation of the quadruped spinning locomotion task in ManiSkill.
Description
The QuadrupedSpinEnv requires a quadruped robot to spin in place as fast as possible, rewarded by its z-axis angular velocity. One robot-specific variant is registered:
AnymalC-Spin-v1(max_episode_steps=200): AnymalC robot spins in place.
The robot is initialized in a standing position on a ground plane. Failure occurs when the robot falls (main body hits the ground). The reward is 2 * angular_velocity_z plus penalties for z-axis linear velocity, xy angular velocity, undesired contacts, and joint deviation from standing pose. Falling results in a reward of -100. Supported robots: anymal_c, unitree_go2_simplified_locomotion. Reward modes include "dense", "normalized_dense", "sparse", and "none".
Usage
Use this environment for agile quadruped locomotion research focused on rotational movement. The spinning task tests whole-body coordination for in-place rotation.
Code Reference
Source Location
- Repository: Haosulab_ManiSkill
- File: mani_skill/envs/tasks/quadruped/quadruped_spin.py
Signature
class QuadrupedSpinEnv(BaseEnv):
SUPPORTED_ROBOTS = ["anymal_c", "unitree_go2_simplified_locomotion"]
...
@register_env("AnymalC-Spin-v1", max_episode_steps=200)
class AnymalCSpinEnv(QuadrupedSpinEnv): ...
Import
import gymnasium as gym
import mani_skill.envs
env = gym.make("AnymalC-Spin-v1")
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| obs_mode | str | No | Observation mode |
| reward_mode | str | No | Reward mode: "dense", "normalized_dense", "sparse", "none" |
| control_mode | str | No | Control mode for the quadruped robot |
Outputs
| Name | Type | Description |
|---|---|---|
| obs | dict/array | Observation including root linear/angular velocities |
| reward | float | Dense reward from angular velocity + stability penalties |
| terminated | bool | Whether robot has fallen |
| truncated | bool | Whether episode hit max steps (200) |
| info | dict | Contains fail, is_fallen flags |
Usage Examples
Basic Usage
import gymnasium as gym
import mani_skill.envs
env = gym.make("AnymalC-Spin-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()