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:Haosulab ManiSkill RotateCube

From Leeroopedia
Knowledge Sources
Domains Robotics, Simulation, Dexterous_Manipulation
Last Updated 2026-02-15 08:00 GMT

Overview

Concrete implementation of the cube rotation task using the TriFingerPro robot in ManiSkill, adapted from IsaacGym.

Description

The RotateCubeEnv requires a TriFingerPro three-finger robot to rotate a cube to match a target position and orientation within a circular arena. The environment is adapted from the NVIDIA IsaacGym Trifinger task.

Registered variants include:

  • RotateCubeLevel0-v1 (max_episode_steps=250): Reach a target cube position.
  • RotateCubeLevel1-v1 (max_episode_steps=250): Reach a target cube position and orientation.

The supported robot is trifingerpro. The arena has radius 0.195m and the cube has a half-size of 0.02m. Key parameters include goal_radius=0.02 and cube_half_size=0.02. Reward modes include "dense", "normalized_dense", "sparse", and "none".

Usage

Use this environment for dexterous manipulation research with multi-finger grippers. The two difficulty levels test position-only and full pose control of the cube.

Code Reference

Source Location

Signature

class RotateCubeEnv(BaseEnv):
    SUPPORTED_ROBOTS = ["trifingerpro"]
    agent: TriFingerPro
    goal_radius = 0.02
    cube_half_size = 0.02
    ARENA_RADIUS = 0.195

@register_env("RotateCubeLevel0-v1", max_episode_steps=250)
class RotateCubeLevel0Env(RotateCubeEnv): ...

@register_env("RotateCubeLevel1-v1", max_episode_steps=250)
class RotateCubeLevel1Env(RotateCubeEnv): ...

Import

import gymnasium as gym
import mani_skill.envs
env = gym.make("RotateCubeLevel0-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 TriFingerPro robot

Outputs

Name Type Description
obs dict/array Observation including finger positions, cube pose, goal pose
reward float Reward based on position/orientation distance to goal
terminated bool Whether episode ended by success/failure
truncated bool Whether episode hit max steps (250)
info dict Contains success flag, position and orientation errors

Usage Examples

Basic Usage

import gymnasium as gym
import mani_skill.envs

env = gym.make("RotateCubeLevel0-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()

Related Pages

Page Connections

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