mani_skill.envs.tasks.drawing#

Submodules#

Classes#

DrawSVGEnv

Task Description:

DrawTriangleEnv

Task Description:

TableTopFreeDrawEnv

Task Description:

Package Contents#

class mani_skill.envs.tasks.drawing.DrawSVGEnv(*args, svg=None, robot_uids='panda_stick', **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Task Description: Instantiates a table with a white canvas on it and a svg path specified with an outline. A robot with a stick is to draw the triangle with a red line.

Randomizations: - the goal svg’s position on the xy-plane is randomized - the goal svg’s z-rotation is randomized in range [0, 2 $pi$]

Success Conditions: - the drawn points by the robot are within a euclidean distance of 0.05m with points on the goal svg

_after_control_step()[source]#

Code that runs after each action has been taken. On GPU simulation this is called right before observations are fetched from the GPU buffers.

_get_obs_extra(info)[source]#

Get task-relevant extra observations. Usually defined on a task by task basis

Parameters:

info (dict) –

_initialize_episode(env_idx, options)[source]#

Initialize the episode, e.g., poses of actors and articulations, as well as task relevant data like randomizing goal positions

Parameters:
  • env_idx (torch.Tensor) –

  • options (dict) –

_load_scene(options)[source]#

Loads all objects like actors and articulations into the scene. Called by self._reconfigure. Given options argument is the same options dictionary passed to the self.reset function

Parameters:

options (dict) –

evaluate()[source]#

Evaluate whether the environment is currently in a success state by returning a dictionary with a “success” key or a failure state via a “fail” key

This function may also return additional data that has been computed (e.g. is the robot grasping some object) that may be reused when generating observations and rewards.

By default if not overriden this function returns an empty dictionary

success_check()[source]#
BRUSH_COLORS = [[0.8, 0.2, 0.2, 1]]#

The colors of the brushes. If there is more than one color, each parallel environment will have a randomly sampled color.

BRUSH_RADIUS = 0.01#

The brushes radius

CANVAS_THICKNESS = 0.02#

How thick the canvas on the table is

DOT_THICKNESS = 0.003#

thickness of the paint drawn on to the canvas

MAX_DOTS = 1000#

The total “ink” available to use and draw with before you need to call env.reset. NOTE that on GPU simulation it is not recommended to have a very high value for this as it can slow down rendering when too many objects are being rendered in many scenes.

SUPPORTED_REWARD_MODES = ['sparse']#
SUPPORTED_ROBOTS: [panda_stick]#

Override this to enforce which robots or tuples of robots together are supported in the task. During env creation, setting robot_uids auto loads all desired robots into the scene, but not all tasks are designed to support some robot setups

THRESHOLD = 0.1#
property _default_human_render_camera_configs#

Add default cameras for rendering when using render_mode=’rgb_array’. These can be overriden by the user at env creation time

property _default_sensor_configs#

Add default (non-agent) sensors to the environment by returning sensor configurations. These can be overriden by the user at env creation time

property _default_sim_config#

a link to a sample video of the task. This is mostly used for automatic documentation generation

agent: mani_skill.agents.robots.panda.panda_stick.PandaStick#
class mani_skill.envs.tasks.drawing.DrawTriangleEnv(*args, robot_uids='panda_stick', **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Task Description: Instantiates a table with a white canvas on it and a goal triangle with an outline. A robot with a stick is to draw the triangle with a red line.

Randomizations: - the goal triangle’s position on the xy-plane is randomized - the goal triangle’s z-rotation is randomized in range [0, 2 $pi$]

Success Conditions: - the drawn points by the robot are within a euclidean distance of 0.05m with points on the goal triangle

_after_control_step()[source]#

Code that runs after each action has been taken. On GPU simulation this is called right before observations are fetched from the GPU buffers.

_get_obs_extra(info)[source]#

Get task-relevant extra observations. Usually defined on a task by task basis

Parameters:

info (dict) –

_initialize_episode(env_idx, options)[source]#

Initialize the episode, e.g., poses of actors and articulations, as well as task relevant data like randomizing goal positions

Parameters:
  • env_idx (torch.Tensor) –

  • options (dict) –

_load_agent(options)[source]#

loads the agent/controllable articulations into the environment. The default function provides a convenient way to setup the agent/robot by a robot_uid (stored in self.robot_uids) without requiring the user to have to write the robot building and controller code themselves. For more advanced use-cases you can override this function to have more control over the agent/robot building process.

Parameters:
  • options (dict) – The options for the environment.

  • initial_agent_poses (Optional[Union[sapien.Pose, Pose]]) – The initial poses of the agent/robot. Providing these poses and ensuring they are picked such that they do not collide with objects if spawned there is highly recommended to ensure more stable simulation (the agent pose can be changed later during episode initialization).

  • build_separate (bool) – Whether to build the agent/robot separately. If True, the agent/robot will be built separately for each parallel environment and then merged together to be accessible under one view/object. This is useful for randomizing physical and visual properties of the agent/robot which is only permitted for articulations built separately in each environment.

_load_scene(options)[source]#

Loads all objects like actors and articulations into the scene. Called by self._reconfigure. Given options argument is the same options dictionary passed to the self.reset function

Parameters:

options (dict) –

evaluate()[source]#

Evaluate whether the environment is currently in a success state by returning a dictionary with a “success” key or a failure state via a “fail” key

This function may also return additional data that has been computed (e.g. is the robot grasping some object) that may be reused when generating observations and rewards.

By default if not overriden this function returns an empty dictionary

generate_triangle_with_points(n, vertices)[source]#
success_check()[source]#
BRUSH_COLORS = [[0.8, 0.2, 0.2, 1]]#

The colors of the brushes. If there is more than one color, each parallel environment will have a randomly sampled color.

BRUSH_RADIUS = 0.01#

The brushes radius

CANVAS_THICKNESS = 0.02#

How thick the canvas on the table is

DOT_THICKNESS = 0.003#

thickness of the paint drawn on to the canvas

MAX_DOTS = 300#

The total “ink” available to use and draw with before you need to call env.reset. NOTE that on GPU simulation it is not recommended to have a very high value for this as it can slow down rendering when too many objects are being rendered in many scenes.

SUPPORTED_REWARD_MODES = ['sparse']#
SUPPORTED_ROBOTS: [panda_stick]#

Override this to enforce which robots or tuples of robots together are supported in the task. During env creation, setting robot_uids auto loads all desired robots into the scene, but not all tasks are designed to support some robot setups

THRESHOLD = 0.025#
property _default_human_render_camera_configs#

Add default cameras for rendering when using render_mode=’rgb_array’. These can be overriden by the user at env creation time

property _default_sensor_configs#

Add default (non-agent) sensors to the environment by returning sensor configurations. These can be overriden by the user at env creation time

property _default_sim_config#

a link to a sample video of the task. This is mostly used for automatic documentation generation

agent: mani_skill.agents.robots.panda.panda_stick.PandaStick#
class mani_skill.envs.tasks.drawing.TableTopFreeDrawEnv(*args, robot_uids='panda_stick', **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Task Description: Instantiates a table with a white canvas on it and a robot with a stick that draws red lines. This environment is primarily for a reference / for others to copy to make their own drawing tasks.

Randomizations: None

Success Conditions: None

Goal Specification: None

_after_control_step()[source]#

Code that runs after each action has been taken. On GPU simulation this is called right before observations are fetched from the GPU buffers.

_get_obs_extra(info)[source]#

Get task-relevant extra observations. Usually defined on a task by task basis

Parameters:

info (dict) –

_initialize_episode(env_idx, options)[source]#

Initialize the episode, e.g., poses of actors and articulations, as well as task relevant data like randomizing goal positions

Parameters:
  • env_idx (torch.Tensor) –

  • options (dict) –

_load_agent(options)[source]#

loads the agent/controllable articulations into the environment. The default function provides a convenient way to setup the agent/robot by a robot_uid (stored in self.robot_uids) without requiring the user to have to write the robot building and controller code themselves. For more advanced use-cases you can override this function to have more control over the agent/robot building process.

Parameters:
  • options (dict) – The options for the environment.

  • initial_agent_poses (Optional[Union[sapien.Pose, Pose]]) – The initial poses of the agent/robot. Providing these poses and ensuring they are picked such that they do not collide with objects if spawned there is highly recommended to ensure more stable simulation (the agent pose can be changed later during episode initialization).

  • build_separate (bool) – Whether to build the agent/robot separately. If True, the agent/robot will be built separately for each parallel environment and then merged together to be accessible under one view/object. This is useful for randomizing physical and visual properties of the agent/robot which is only permitted for articulations built separately in each environment.

_load_scene(options)[source]#

Loads all objects like actors and articulations into the scene. Called by self._reconfigure. Given options argument is the same options dictionary passed to the self.reset function

Parameters:

options (dict) –

evaluate()[source]#

Evaluate whether the environment is currently in a success state by returning a dictionary with a “success” key or a failure state via a “fail” key

This function may also return additional data that has been computed (e.g. is the robot grasping some object) that may be reused when generating observations and rewards.

By default if not overriden this function returns an empty dictionary

BRUSH_COLORS = [[0.8, 0.2, 0.2, 1]]#

The colors of the brushes. If there is more than one color, each parallel environment will have a randomly sampled color.

BRUSH_RADIUS = 0.01#

The brushes radius

CANVAS_THICKNESS = 0.02#

How thick the canvas on the table is

DOT_THICKNESS = 0.003#

thickness of the paint drawn on to the canvas

MAX_DOTS = 1010#

The total “ink” available to use and draw with before you need to call env.reset. NOTE that on GPU simulation it is not recommended to have a very high value for this as it can slow down rendering when too many objects are being rendered in many scenes.

SUPPORTED_REWARD_MODES = ['none']#
SUPPORTED_ROBOTS: [panda_stick]#

Override this to enforce which robots or tuples of robots together are supported in the task. During env creation, setting robot_uids auto loads all desired robots into the scene, but not all tasks are designed to support some robot setups

property _default_human_render_camera_configs#

Add default cameras for rendering when using render_mode=’rgb_array’. These can be overriden by the user at env creation time

property _default_sensor_configs#

Add default (non-agent) sensors to the environment by returning sensor configurations. These can be overriden by the user at env creation time

property _default_sim_config#

a link to a sample video of the task. This is mostly used for automatic documentation generation

agent: mani_skill.agents.robots.panda.panda_stick.PandaStick#