Implementation:Haosulab ManiSkill RotateSingleObjectInHand
| Knowledge Sources | |
|---|---|
| Domains | Robotics, Simulation, Dexterous_Manipulation |
| Last Updated | 2026-02-15 08:00 GMT |
Overview
Concrete implementation of the in-hand object rotation dexterous manipulation task in ManiSkill using the Allegro Hand robot.
Description
The RotateSingleObjectInHand environment requires the Allegro Hand Right (with touch sensors) to rotate an object in-hand to match a target orientation. The task has four difficulty levels (0-3):
- Level 0: Rotate a cube by a random angle around the z-axis only.
- Level 1: Rotate a cube to a random orientation.
- Level 2: Rotate a random YCB object by a random angle around the z-axis.
- Level 3: Rotate a random YCB object to a random orientation.
Registered variants include:
RotateSingleObjectInHandLevel0-v1(max_episode_steps=300)RotateSingleObjectInHandLevel1-v1(max_episode_steps=300)RotateSingleObjectInHandLevel2-v1(max_episode_steps=300, asset_download_ids=["ycb"])RotateSingleObjectInHandLevel3-v1(max_episode_steps=300, asset_download_ids=["ycb"])
The supported robot is allegro_hand_right_touch. Reward modes include "dense", "normalized_dense", "sparse", and "none".
Usage
Use this environment for dexterous manipulation research, specifically in-hand object rotation. Higher difficulty levels introduce geometric variability through YCB objects and full 3D rotation targets.
Code Reference
Source Location
- Repository: Haosulab_ManiSkill
- File: mani_skill/envs/tasks/dexterity/rotate_single_object_in_hand.py
Signature
class RotateSingleObjectInHand(BaseEnv):
agent: Union[AllegroHandRightTouch]
def __init__(self, *args, robot_init_qpos_noise=0.02, obj_init_pos_noise=0.02,
difficulty_level: int = -1, num_envs=1, reconfiguration_freq=None, **kwargs): ...
@register_env("RotateSingleObjectInHandLevel0-v1", max_episode_steps=300)
class RotateSingleObjectInHandLevel0(RotateSingleObjectInHand): ...
Import
import gymnasium as gym
import mani_skill.envs
env = gym.make("RotateSingleObjectInHandLevel0-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 Allegro Hand |
Outputs
| Name | Type | Description |
|---|---|---|
| obs | dict/array | Observation including hand joint state, object pose, goal orientation |
| reward | float | Reward based on orientation distance to target |
| terminated | bool | Whether episode ended (object dropped) |
| truncated | bool | Whether episode hit max steps (300) |
| info | dict | Contains success, object_dropped flags |
Usage Examples
Basic Usage
import gymnasium as gym
import mani_skill.envs
env = gym.make("RotateSingleObjectInHandLevel0-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()