Implementation:Haosulab ManiSkill DrawSVG
| Knowledge Sources | |
|---|---|
| Domains | Robotics, Simulation, Drawing |
| Last Updated | 2026-02-15 08:00 GMT |
Overview
Concrete implementation of the SVG drawing task environment in ManiSkill.
Description
The DrawSVGEnv instantiates a table with a white canvas and a robot with a stick that must trace an SVG path. The robot draws red lines by placing colored dots on the canvas when the brush is close enough to the surface. Key parameters include MAX_DOTS=1000 for total ink available, BRUSH_RADIUS=0.01, and a success THRESHOLD of 0.1.
Registered as DrawSVG-v1 with max_episode_steps=500. The supported robot is panda_stick (PandaStick). The reward mode is "sparse" and success is measured by how well drawn points match the goal SVG path within a euclidean distance threshold.
Randomizations include the SVG position on the xy-plane and its z-rotation in range [0, 2*pi].
Usage
Use this environment for learning path-following and drawing behaviors with a robot manipulator. It extends the base drawing environment with SVG path targets.
Code Reference
Source Location
- Repository: Haosulab_ManiSkill
- File: mani_skill/envs/tasks/drawing/draw_svg.py
Signature
@register_env("DrawSVG-v1", max_episode_steps=500)
class DrawSVGEnv(BaseEnv):
SUPPORTED_REWARD_MODES = ["sparse"]
SUPPORTED_ROBOTS: ["panda_stick"]
agent: PandaStick
MAX_DOTS = 1000
BRUSH_RADIUS = 0.01
THRESHOLD = 0.1
Import
import gymnasium as gym
import mani_skill.envs
env = gym.make("DrawSVG-v1")
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| obs_mode | str | No | Observation mode |
| reward_mode | str | No | Reward mode: "sparse" |
| control_mode | str | No | Control mode for panda_stick robot |
Outputs
| Name | Type | Description |
|---|---|---|
| obs | dict/array | Observation including TCP pose and canvas state |
| reward | float | Sparse reward based on coverage of SVG path |
| terminated | bool | Whether episode ended by success/failure |
| truncated | bool | Whether episode hit max steps (500) |
| info | dict | Contains success flag and coverage metrics |
Usage Examples
Basic Usage
import gymnasium as gym
import mani_skill.envs
env = gym.make("DrawSVG-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()