Implementation:Haosulab ManiSkill PlugCharger
| Knowledge Sources | |
|---|---|
| Domains | Robotics, Simulation, Tabletop_Manipulation |
| Last Updated | 2026-02-15 08:00 GMT |
Overview
Concrete implementation of the charger plugging task environment in ManiSkill.
Description
The PlugChargerEnv requires a robot to pick up a charger and insert it into a receptacle on the table. Both the charger and receptacle have randomized positions and rotations on the XY plane.
Registered as PlugCharger-v1 with max_episode_steps=200. The supported robot is panda_wristcam (PandaWristCam). Reward modes include "normalized_dense", "dense", "sparse", and "none".
Randomizations include the charger position/rotation on the table and the receptacle position/rotation. The human render camera pose is fixed relative to the receptacle. Success is determined by the charger being properly inserted into the receptacle.
Usage
Use this environment for precision insertion research. The task requires accurate alignment of the charger prongs with the receptacle slots, testing both grasping and fine alignment skills.
Code Reference
Source Location
- Repository: Haosulab_ManiSkill
- File: mani_skill/envs/tasks/tabletop/plug_charger.py
Signature
@register_env("PlugCharger-v1", max_episode_steps=200)
class PlugChargerEnv(BaseEnv):
SUPPORTED_ROBOTS = ["panda_wristcam"]
agent: Union[PandaWristCam]
Import
import gymnasium as gym
import mani_skill.envs
env = gym.make("PlugCharger-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 Panda robot |
Outputs
| Name | Type | Description |
|---|---|---|
| obs | dict/array | Observation including TCP pose, charger pose, receptacle pose |
| reward | float | Dense reward based on grasping, alignment, and insertion |
| terminated | bool | Whether episode ended by success |
| truncated | bool | Whether episode hit max steps (200) |
| info | dict | Contains success flag |
Usage Examples
Basic Usage
import gymnasium as gym
import mani_skill.envs
env = gym.make("PlugCharger-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()