Implementation:Haosulab ManiSkill AntEnv
| Knowledge Sources | |
|---|---|
| Domains | Robotics, Simulation, Control |
| Last Updated | 2026-02-15 08:00 GMT |
Overview
Concrete implementation of the Ant locomotion control task environment in ManiSkill, adapted from the DeepMind Control Suite.
Description
The AntEnv defines a quadruped "ant" robot locomotion task where the agent must control an ant-like robot to stand, walk, or run. The ant robot is defined inline via MJCF and has 8 actuated joints. Three registered variants exist:
MS-AntStand-v1(max_episode_steps=100): The ant must maintain a standing posture at a target height of 0.55m.MS-AntWalk-v1(max_episode_steps=100): The ant must walk at a target speed of 0.5 m/s.MS-AntRun-v1(max_episode_steps=100): The ant must run at a target speed of 4 m/s.
The robot uses PD joint position control. Rewards are composed of standing height reward, movement speed reward, and a control cost penalty. The supported robot is ant (defined in the same file as AntRobot).
Usage
Use this environment for benchmarking locomotion control algorithms. It provides dense and normalized dense reward modes, making it suitable for reinforcement learning research on multi-legged locomotion tasks.
Code Reference
Source Location
- Repository: Haosulab_ManiSkill
- File: mani_skill/envs/tasks/control/ant.py
Signature
@register_env("MS-AntStand-v1", max_episode_steps=100)
class AntStandEnv(AntEnvBase):
...
@register_env("MS-AntWalk-v1", max_episode_steps=100)
class AntWalkEnv(AntEnvBase):
...
@register_env("MS-AntRun-v1", max_episode_steps=100)
class AntRunEnv(AntEnvBase):
...
Import
import gymnasium as gym
import mani_skill.envs
env = gym.make("MS-AntWalk-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 ant robot |
Outputs
| Name | Type | Description |
|---|---|---|
| obs | dict/array | Observation including joint positions, velocities, and robot state |
| reward | float | Composed of standing reward, movement reward, and control cost |
| terminated | bool | Whether episode ended by success/failure |
| truncated | bool | Whether episode hit max steps (100) |
| info | dict | Contains evaluation metrics |
Usage Examples
Basic Usage
import gymnasium as gym
import mani_skill.envs
env = gym.make("MS-AntWalk-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()