Implementation:Haosulab ManiSkill StackCube
| Knowledge Sources | |
|---|---|
| Domains | Robotics, Simulation, Tabletop_Manipulation |
| Last Updated | 2026-02-15 08:00 GMT |
Overview
Concrete implementation of the cube stacking task environment in ManiSkill.
Description
The StackCubeEnv requires a robot to pick up a red cube and stack it on top of a green cube, then release it without the red cube falling off.
Registered as StackCube-v1 with max_episode_steps=50. Supported robots: panda and fetch. Reward modes include "normalized_dense", "dense", "sparse", and "none".
Randomizations: both cubes have z-axis rotation randomized, xy positions randomized on the table such that they do not collide. Success requires the red cube to be on top of the green cube (within half cube size), the red cube to be static, and the robot to not be grasping the red cube.
Usage
Use this environment for sequential manipulation research. Stacking requires grasping, precise placement, and careful release -- a fundamental skill in robotic manipulation.
Code Reference
Source Location
- Repository: Haosulab_ManiSkill
- File: mani_skill/envs/tasks/tabletop/stack_cube.py
Signature
@register_env("StackCube-v1", max_episode_steps=50)
class StackCubeEnv(BaseEnv):
SUPPORTED_ROBOTS = ["panda", "fetch"]
agent: Union[Panda, Fetch]
Import
import gymnasium as gym
import mani_skill.envs
env = gym.make("StackCube-v1")
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| obs_mode | str | No | Observation mode |
| reward_mode | str | No | Reward mode: "normalized_dense", "dense", "sparse", "none" |
| control_mode | str | No | Control mode for the robot |
Outputs
| Name | Type | Description |
|---|---|---|
| obs | dict/array | Observation including TCP pose, cubeA/cubeB poses, is_grasped |
| reward | float | Dense reward: reaching + grasping + placing + static + release |
| terminated | bool | Whether episode ended by success |
| truncated | bool | Whether episode hit max steps (50) |
| info | dict | Contains success, is_cubeA_on_cubeB, is_cubeA_static, is_grasped |
Usage Examples
Basic Usage
import gymnasium as gym
import mani_skill.envs
env = gym.make("StackCube-v1", obs_mode="state", render_mode="rgb_array")
obs, info = env.reset()
for _ in range(50):
action = env.action_space.sample()
obs, reward, terminated, truncated, info = env.step(action)
if terminated or truncated:
obs, info = env.reset()
env.close()