mani_skill.envs.tasks#

Submodules#

Classes#

AntRun

Task Description:

AntWalk

Task Description:

AssemblingKitsEnv

Task Description:

CartpoleBalanceEnv

Task Description:

CartpoleSwingUpEnv

Task Description:

DrawSVGEnv

Task Description:

DrawTriangleEnv

Task Description:

EmptyEnv

Superclass for ManiSkill environments.

FMBAssembly1Env

Task Description

HopperHopEnv

Task Description:

HopperStandEnv

Task Description:

HumanoidPlaceAppleInBowl

Superclass for ManiSkill environments.

HumanoidRun

Task Description:

HumanoidStand

Task Description:

HumanoidStandEnv

Superclass for ManiSkill environments.

HumanoidWalk

Task Description:

InsertFlowerEnv

Superclass for ManiSkill environments.

LiftPegUprightEnv

Task Description:

OpenCabinetDoorEnv

Task Description:

OpenCabinetDrawerEnv

Task Description:

PegInsertionSideEnv

Task Description:

PickClutterYCBEnv

Base environment picking items out of clutter type of tasks. Flexibly supports using different configurations and object datasets

PickCubeEnv

Superclass for ManiSkill environments.

PickSingleYCBEnv

Task Description:

PlaceSphereEnv

Task Description:

PlugChargerEnv

Task Description:

PokeCubeEnv

Task Description:

PullCubeEnv

Task Description:

PullCubeToolEnv

Task Description

PushCubeEnv

Task Description:

PushTEnv

Task Description:

PutCarrotOnPlateInScene

Base Digital Twin environment for digital twins of the BridgeData v2

PutEggplantInBasketScene

Base Digital Twin environment for digital twins of the BridgeData v2

PutSpoonOnTableClothInScene

Base Digital Twin environment for digital twins of the BridgeData v2

QuadrupedReachEnv

Superclass for ManiSkill environments.

QuadrupedSpinEnv

Superclass for ManiSkill environments.

RoboCasaKitchenEnv

Superclass for ManiSkill environments.

RollBallEnv

Task Description:

RotateCubeEnv

Modified from NVIDIA-Omniverse/IsaacGymEnvs

RotateSingleObjectInHand

Superclass for ManiSkill environments.

RotateValveEnv

Superclass for ManiSkill environments.

SO100GraspCubeEnv

Task Description:

StackCubeEnv

Task Description:

StackGreenCubeOnYellowCubeBakedTexInScene

Base Digital Twin environment for digital twins of the BridgeData v2

StackPyramidEnv

Task Description:

TableTopFreeDrawEnv

Task Description:

TransportBoxEnv

Task Description:

TurnFaucetEnv

Superclass for ManiSkill environments.

TwoRobotPickCube

Task Description:

TwoRobotStackCube

Task Description:

Package Contents#

class mani_skill.envs.tasks.AntRun(*args, **kwargs)[source]#

Bases: AntEnv

Task Description: Ant moves in x direction at 4 m/s

Randomizations: - Ant qpos and qvel have added noise from uniform distribution [-1e-2, 1e-2]

Success Conditions: - No specific success conditions.

class mani_skill.envs.tasks.AntWalk(*args, **kwargs)[source]#

Bases: AntEnv

Task Description: Ant moves in x direction at 0.5 m/s

Randomizations: - Ant qpos and qvel have added noise from uniform distribution [-1e-2, 1e-2]

Success Conditions: - No specific success conditions.

class mani_skill.envs.tasks.AssemblingKitsEnv(asset_root=f'{ASSET_DIR}/tasks/assembling_kits', robot_uids='panda_wristcam', num_envs=1, reconfiguration_freq=None, **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Task Description: The robot must pick up one of the misplaced shapes on the board/kit and insert it into the correct empty slot.

Randomizations: - the kit geometry is randomized, with different already inserted shapes and different holes affording insertion of specific shapes. (during reconfiguration) - the misplaced shape’s geometry is sampled from one of 20 different shapes. (during reconfiguration) - the misplaced shape is randomly spawned anywhere on top of the board with a random z-axis rotation

Success Conditions: - the misplaced shape is inserted completely into the correct slot

_check_in_slot(obj, height_eps=0.003)[source]#
Parameters:

obj (mani_skill.utils.structs.Actor) –

_check_pos_diff(pos_eps=0.02)[source]#
_check_rot_diff(rot_eps=np.deg2rad(4))[source]#
_get_kit_builder_and_goals(kit_id)[source]#
Parameters:

kit_id (str) –

_get_object_builder(object_id, static=False, color_id=0)[source]#
Parameters:
  • object_id (str) –

  • static (bool) –

  • color_id (int) –

_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) –

_parse_json(path)[source]#

Parse kit JSON information and return the goal positions and rotations

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

Return type:

dict

SUPPORTED_REWARD_MODES = ['sparse', 'none']#
SUPPORTED_ROBOTS = ['panda_wristcam']#

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#
_episode_json#
_episodes#
_kit_dir#
_models_dir#

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

agent: mani_skill.agents.robots.PandaWristCam#
asset_root#
color#
episode_idx = None#
object_scale#
symmetry#
class mani_skill.envs.tasks.CartpoleBalanceEnv(*args, **kwargs)[source]#

Bases: CartpoleEnv

Task Description: Use the Cartpole robot to balance a pole on a cart.

Randomizations: - Pole direction is randomized around the vertical axis. the range is [-0.05, 0.05] radians.

Fail Conditions: - Pole is lower than the horizontal plane

_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) –

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

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

class mani_skill.envs.tasks.CartpoleSwingUpEnv(*args, **kwargs)[source]#

Bases: CartpoleEnv

Task Description: Use the Cartpole robot to swing up a pole on a cart.

Randomizations: - Pole direction is randomized around the whole circle. the range is [-pi, pi] radians.

Success Conditions: - No specific success conditions. The task is considered successful if the pole is upright for the whole episode.

_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) –

SUPPORTED_REWARD_MODES = ('normalized_dense', 'dense', 'none')#
class mani_skill.envs.tasks.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.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.EmptyEnv(*args, robot_uids='panda', **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Superclass for ManiSkill environments.

Parameters:
  • num_envs – number of parallel environments to run. By default this is 1, which means a CPU simulation is used. If greater than 1, then we initialize the GPU simulation setup. Note that not all environments are faster when simulated on the GPU due to limitations of GPU simulations. For example, environments with many moving objects are better simulated by parallelizing across CPUs.

  • obs_mode – observation mode to be used. Must be one of (“state”, “state_dict”, “none”, “sensor_data”, “rgb”, “depth”, “segmentation”, “rgbd”, “rgb+depth”, “rgb+depth+segmentation”, “rgb+segmentation”, “depth+segmentation”, “pointcloud”) The obs_mode is mostly for convenience to automatically optimize/setup all sensors/cameras for the given observation mode to render the correct data and try to ignore unnecessary rendering. For the most advanced use cases (e.g. you have 1 RGB only camera and 1 depth only camera)

  • reward_mode – reward mode to use. Must be one of (“normalized_dense”, “dense”, “sparse”, “none”). With “none” the reward returned is always 0

  • control_mode – control mode of the agent. “*” represents all registered controllers, and the action space will be a dict.

  • render_mode – render mode registered in @SUPPORTED_RENDER_MODES.

  • shader_dir (Optional[str]) –

    shader directory. Defaults to None. Setting this will override the shader used for all cameras in the environment. This is legacy behavior kept for backwards compatibility. The proper way to change the shaders used for cameras is to either change the environment code or pass in sensor_configs/human_render_camera_configs with the desired shaders.

    Previously the options are “default”, “rt”, “rt-fast”. “rt” means ray-tracing which results in more photorealistic renders but is slow, “rt-fast” is a lower quality but faster version of “rt”.

  • enable_shadow (bool) – whether to enable shadow for lights. Defaults to False.

  • sensor_configs (dict) – configurations of sensors to override any environment defaults. If the key is one of sensor names (e.g. a camera), the config value will be applied to the corresponding sensor. Otherwise, the value will be applied to all sensors (but overridden by sensor-specific values). For possible configurations see the documentation see the sensors documentation.

  • human_render_camera_configs (dict) – configurations of human rendering cameras to override any environment defaults. Similar usage as @sensor_configs.

  • viewer_camera_configs (dict) – configurations of the viewer camera in the GUI to override any environment defaults. Similar usage as @sensor_configs.

  • robot_uids (Union[str, BaseAgent, list[Union[str, BaseAgent]]]) – list of robots to instantiate and control in the environment.

  • sim_config (Union[SimConfig, dict]) – Configurations for simulation if used that override the environment defaults. If given a dictionary, it can just override specific attributes e.g. sim_config=dict(scene_config=dict(solver_iterations=25)). If passing in a SimConfig object, while typed, will override every attribute including the task defaults. Some environments define their own recommended default sim configurations via the self._default_sim_config attribute that generally should not be completely overriden.

  • reconfiguration_freq (int) – How frequently to call reconfigure when environment is reset via self.reset(…) Generally for most users who are not building tasks this does not need to be changed. The default is 0, which means the environment reconfigures upon creation, and never again.

  • sim_backend (str) – By default this is “auto”. If sim_backend is “auto”, then if num_envs == 1, we use the PhysX CPU sim backend, otherwise we use the PhysX GPU sim backend and automatically pick a GPU to use. Can also be “physx_cpu” or “physx_cuda” to force usage of a particular sim backend. To select a particular GPU to run the simulation on, you can pass “physx_cuda:n” where n is the ID of the GPU, similar to the way PyTorch selects GPUs. Note that if this is “physx_cpu”, num_envs can only be equal to 1.

  • render_backend (str) –

    By default this is “gpu”. If render_backend is “gpu” or it’s alias “sapien_cuda”, then we auto select a GPU to render with. It can be “sapien_cuda:n” where n is the ID of the GPU to render with. If this is “cpu” or “sapien_cpu”, then we try to render on the CPU. If this is “none” or None, then we disable rendering.

    Note that some environments may require rendering functionalities to work. Moreover it is sometimes difficult to determine before running an environment if your machine can render or not. If you encounter some issue with rendering you can first try to double check your NVIDIA drivers / Vulkan drivers are setup correctly. If you don’t need to do rendering you can simply disable it by setting render_backend to “none” or None.

  • parallel_in_single_scene (bool) – By default this is False. If True, rendered images and the GUI will show all objects in one view. This is only really useful for generating cool videos showing all environments at once but it is not recommended otherwise as it slows down simulation and rendering.

  • enhanced_determinism (bool) – By default this is False and env resets will reset the episode RNG only when a seed / seed list is given. If True, the environment will reset the episode RNG upon each reset regardless of whether a seed is provided. Generally enhanced_determinisim is not needed and users are recommended to pass seeds into the env reset function instead.

_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

SUPPORTED_REWARD_MODES = ['none']#

This is just a dummy environment for showcasing robots in a empty scene

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

class mani_skill.envs.tasks.FMBAssembly1Env(*args, robot_uids='panda', robot_init_qpos_noise=0.02, **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Task Description#

This task is a simulation version of one of the Multi-Object Multi-Stage Manipulation Tasks (Assembly1) from [Functional Manipulation Benchmark (Luo et. al)](https://functional-manipulation-benchmark.github.io/index.html). The goal here is to assemble parts together with the help of a reorientation fixture onto a red board.

Randomizations#

  • TODO

Success Conditions#

Visualization: TODO: ADD LINK HERE

_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

SUPPORTED_REWARD_MODES = ['sparse', 'none']#
SUPPORTED_ROBOTS = ['panda']#

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#
agent: mani_skill.agents.robots.panda.panda.Panda#
robot_init_qpos_noise = 0.02#
class mani_skill.envs.tasks.HopperHopEnv(*args, **kwargs)[source]#

Bases: HopperEnv

Task Description: Hopper robot stays upright and moves in positive x direction with hopping motion

Randomizations: - Hopper robot is randomly rotated [-pi, pi] radians about y axis. - Hopper qpos are uniformly sampled within their allowed ranges

Success Conditions: - No specific success conditions. The task is considered successful if the hopper hops for the whole episode.

compute_dense_reward(obs, action, info)[source]#

Compute the dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

class mani_skill.envs.tasks.HopperStandEnv(*args, **kwargs)[source]#

Bases: HopperEnv

Task Description: Hopper robot stands upright

Randomizations: - Hopper robot is randomly rotated [-pi, pi] radians about y axis. - Hopper qpos are uniformly sampled within their allowed ranges

Success Conditions: - No specific success conditions.

compute_dense_reward(obs, action, info)[source]#

Compute the dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

class mani_skill.envs.tasks.HumanoidPlaceAppleInBowl(*args, robot_init_qpos_noise=0.02, **kwargs)[source]#

Bases: HumanoidPickPlaceEnv

Superclass for ManiSkill environments.

Parameters:
  • num_envs – number of parallel environments to run. By default this is 1, which means a CPU simulation is used. If greater than 1, then we initialize the GPU simulation setup. Note that not all environments are faster when simulated on the GPU due to limitations of GPU simulations. For example, environments with many moving objects are better simulated by parallelizing across CPUs.

  • obs_mode – observation mode to be used. Must be one of (“state”, “state_dict”, “none”, “sensor_data”, “rgb”, “depth”, “segmentation”, “rgbd”, “rgb+depth”, “rgb+depth+segmentation”, “rgb+segmentation”, “depth+segmentation”, “pointcloud”) The obs_mode is mostly for convenience to automatically optimize/setup all sensors/cameras for the given observation mode to render the correct data and try to ignore unnecessary rendering. For the most advanced use cases (e.g. you have 1 RGB only camera and 1 depth only camera)

  • reward_mode – reward mode to use. Must be one of (“normalized_dense”, “dense”, “sparse”, “none”). With “none” the reward returned is always 0

  • control_mode – control mode of the agent. “*” represents all registered controllers, and the action space will be a dict.

  • render_mode – render mode registered in @SUPPORTED_RENDER_MODES.

  • shader_dir (Optional[str]) –

    shader directory. Defaults to None. Setting this will override the shader used for all cameras in the environment. This is legacy behavior kept for backwards compatibility. The proper way to change the shaders used for cameras is to either change the environment code or pass in sensor_configs/human_render_camera_configs with the desired shaders.

    Previously the options are “default”, “rt”, “rt-fast”. “rt” means ray-tracing which results in more photorealistic renders but is slow, “rt-fast” is a lower quality but faster version of “rt”.

  • enable_shadow (bool) – whether to enable shadow for lights. Defaults to False.

  • sensor_configs (dict) – configurations of sensors to override any environment defaults. If the key is one of sensor names (e.g. a camera), the config value will be applied to the corresponding sensor. Otherwise, the value will be applied to all sensors (but overridden by sensor-specific values). For possible configurations see the documentation see the sensors documentation.

  • human_render_camera_configs (dict) – configurations of human rendering cameras to override any environment defaults. Similar usage as @sensor_configs.

  • viewer_camera_configs (dict) – configurations of the viewer camera in the GUI to override any environment defaults. Similar usage as @sensor_configs.

  • robot_uids (Union[str, BaseAgent, list[Union[str, BaseAgent]]]) – list of robots to instantiate and control in the environment.

  • sim_config (Union[SimConfig, dict]) – Configurations for simulation if used that override the environment defaults. If given a dictionary, it can just override specific attributes e.g. sim_config=dict(scene_config=dict(solver_iterations=25)). If passing in a SimConfig object, while typed, will override every attribute including the task defaults. Some environments define their own recommended default sim configurations via the self._default_sim_config attribute that generally should not be completely overriden.

  • reconfiguration_freq (int) – How frequently to call reconfigure when environment is reset via self.reset(…) Generally for most users who are not building tasks this does not need to be changed. The default is 0, which means the environment reconfigures upon creation, and never again.

  • sim_backend (str) – By default this is “auto”. If sim_backend is “auto”, then if num_envs == 1, we use the PhysX CPU sim backend, otherwise we use the PhysX GPU sim backend and automatically pick a GPU to use. Can also be “physx_cpu” or “physx_cuda” to force usage of a particular sim backend. To select a particular GPU to run the simulation on, you can pass “physx_cuda:n” where n is the ID of the GPU, similar to the way PyTorch selects GPUs. Note that if this is “physx_cpu”, num_envs can only be equal to 1.

  • render_backend (str) –

    By default this is “gpu”. If render_backend is “gpu” or it’s alias “sapien_cuda”, then we auto select a GPU to render with. It can be “sapien_cuda:n” where n is the ID of the GPU to render with. If this is “cpu” or “sapien_cpu”, then we try to render on the CPU. If this is “none” or None, then we disable rendering.

    Note that some environments may require rendering functionalities to work. Moreover it is sometimes difficult to determine before running an environment if your machine can render or not. If you encounter some issue with rendering you can first try to double check your NVIDIA drivers / Vulkan drivers are setup correctly. If you don’t need to do rendering you can simply disable it by setting render_backend to “none” or None.

  • parallel_in_single_scene (bool) – By default this is False. If True, rendered images and the GUI will show all objects in one view. This is only really useful for generating cool videos showing all environments at once but it is not recommended otherwise as it slows down simulation and rendering.

  • enhanced_determinism (bool) – By default this is False and env resets will reset the episode RNG only when a seed / seed list is given. If True, the environment will reset the episode RNG upon each reset regardless of whether a seed is provided. Generally enhanced_determinisim is not needed and users are recommended to pass seeds into the env reset function instead.

_get_obs_extra(info)[source]#

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

Parameters:

info (dict) –

_grasp_release_reward()[source]#

a dense reward that rewards the agent for opening their hand

_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) –

compute_dense_reward(obs, action, info)[source]#

Compute the dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

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

SUPPORTED_REWARD_MODES = ['normalized_dense', 'dense', 'sparse', 'none']#

sets up a basic scene with a apple to pick up and place on a dish

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

class mani_skill.envs.tasks.HumanoidRun(*args, robot_uids='humanoid', **kwargs)[source]#

Bases: HumanoidEnvStandard

Task Description: Humanoid moves in x direction at running pace

Randomizations: - Humanoid qpos and qvel have added noise from uniform distribution [-1e-2, 1e-2]

Fail Conditions: - Humanoid robot torso link leaves z range [0.7, 1.0]

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

agent: mani_skill.agents.robots.humanoid.Humanoid#
class mani_skill.envs.tasks.HumanoidStand(*args, robot_uids='humanoid', **kwargs)[source]#

Bases: HumanoidEnvStandard

Task Description: Humanoid robot stands upright

Randomizations: - Humanoid robot is randomly rotated [-pi, pi] radians about z axis. - Humanoid qpos and qvel have added noise from uniform distribution [-1e-2, 1e-2]

Fail Conditions: - Humanoid robot torso link leaves z range [0.7, 1.0]

_get_obs_state_dict(info)[source]#

Get (ground-truth) state-based observations.

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) –

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

agent: mani_skill.agents.robots.humanoid.Humanoid#
class mani_skill.envs.tasks.HumanoidStandEnv(*args, robot_uids='unitree_h1_simplified', robot_init_qpos_noise=0.02, **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Superclass for ManiSkill environments.

Parameters:
  • num_envs – number of parallel environments to run. By default this is 1, which means a CPU simulation is used. If greater than 1, then we initialize the GPU simulation setup. Note that not all environments are faster when simulated on the GPU due to limitations of GPU simulations. For example, environments with many moving objects are better simulated by parallelizing across CPUs.

  • obs_mode – observation mode to be used. Must be one of (“state”, “state_dict”, “none”, “sensor_data”, “rgb”, “depth”, “segmentation”, “rgbd”, “rgb+depth”, “rgb+depth+segmentation”, “rgb+segmentation”, “depth+segmentation”, “pointcloud”) The obs_mode is mostly for convenience to automatically optimize/setup all sensors/cameras for the given observation mode to render the correct data and try to ignore unnecessary rendering. For the most advanced use cases (e.g. you have 1 RGB only camera and 1 depth only camera)

  • reward_mode – reward mode to use. Must be one of (“normalized_dense”, “dense”, “sparse”, “none”). With “none” the reward returned is always 0

  • control_mode – control mode of the agent. “*” represents all registered controllers, and the action space will be a dict.

  • render_mode – render mode registered in @SUPPORTED_RENDER_MODES.

  • shader_dir (Optional[str]) –

    shader directory. Defaults to None. Setting this will override the shader used for all cameras in the environment. This is legacy behavior kept for backwards compatibility. The proper way to change the shaders used for cameras is to either change the environment code or pass in sensor_configs/human_render_camera_configs with the desired shaders.

    Previously the options are “default”, “rt”, “rt-fast”. “rt” means ray-tracing which results in more photorealistic renders but is slow, “rt-fast” is a lower quality but faster version of “rt”.

  • enable_shadow (bool) – whether to enable shadow for lights. Defaults to False.

  • sensor_configs (dict) – configurations of sensors to override any environment defaults. If the key is one of sensor names (e.g. a camera), the config value will be applied to the corresponding sensor. Otherwise, the value will be applied to all sensors (but overridden by sensor-specific values). For possible configurations see the documentation see the sensors documentation.

  • human_render_camera_configs (dict) – configurations of human rendering cameras to override any environment defaults. Similar usage as @sensor_configs.

  • viewer_camera_configs (dict) – configurations of the viewer camera in the GUI to override any environment defaults. Similar usage as @sensor_configs.

  • robot_uids (Union[str, BaseAgent, list[Union[str, BaseAgent]]]) – list of robots to instantiate and control in the environment.

  • sim_config (Union[SimConfig, dict]) – Configurations for simulation if used that override the environment defaults. If given a dictionary, it can just override specific attributes e.g. sim_config=dict(scene_config=dict(solver_iterations=25)). If passing in a SimConfig object, while typed, will override every attribute including the task defaults. Some environments define their own recommended default sim configurations via the self._default_sim_config attribute that generally should not be completely overriden.

  • reconfiguration_freq (int) – How frequently to call reconfigure when environment is reset via self.reset(…) Generally for most users who are not building tasks this does not need to be changed. The default is 0, which means the environment reconfigures upon creation, and never again.

  • sim_backend (str) – By default this is “auto”. If sim_backend is “auto”, then if num_envs == 1, we use the PhysX CPU sim backend, otherwise we use the PhysX GPU sim backend and automatically pick a GPU to use. Can also be “physx_cpu” or “physx_cuda” to force usage of a particular sim backend. To select a particular GPU to run the simulation on, you can pass “physx_cuda:n” where n is the ID of the GPU, similar to the way PyTorch selects GPUs. Note that if this is “physx_cpu”, num_envs can only be equal to 1.

  • render_backend (str) –

    By default this is “gpu”. If render_backend is “gpu” or it’s alias “sapien_cuda”, then we auto select a GPU to render with. It can be “sapien_cuda:n” where n is the ID of the GPU to render with. If this is “cpu” or “sapien_cpu”, then we try to render on the CPU. If this is “none” or None, then we disable rendering.

    Note that some environments may require rendering functionalities to work. Moreover it is sometimes difficult to determine before running an environment if your machine can render or not. If you encounter some issue with rendering you can first try to double check your NVIDIA drivers / Vulkan drivers are setup correctly. If you don’t need to do rendering you can simply disable it by setting render_backend to “none” or None.

  • parallel_in_single_scene (bool) – By default this is False. If True, rendered images and the GUI will show all objects in one view. This is only really useful for generating cool videos showing all environments at once but it is not recommended otherwise as it slows down simulation and rendering.

  • enhanced_determinism (bool) – By default this is False and env resets will reset the episode RNG only when a seed / seed list is given. If True, the environment will reset the episode RNG upon each reset regardless of whether a seed is provided. Generally enhanced_determinisim is not needed and users are recommended to pass seeds into the env reset function instead.

_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) –

compute_sparse_reward(obs, action, info)[source]#

Computes the sparse reward. By default this function tries to use the success/fail information in returned by the evaluate function and gives +1 if success, -1 if fail, 0 otherwise.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

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

SUPPORTED_REWARD_MODES = ['sparse', 'none']#
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

robot_init_qpos_noise = 0.02#
class mani_skill.envs.tasks.HumanoidWalk(*args, robot_uids='humanoid', **kwargs)[source]#

Bases: HumanoidEnvStandard

Task Description: Humanoid moves in x direction at walking pace

Randomizations: - Humanoid qpos and qvel have added noise from uniform distribution [-1e-2, 1e-2]

Fail Conditions: - Humanoid robot torso link leaves z range [0.7, 1.0]

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

agent: mani_skill.agents.robots.humanoid.Humanoid#
class mani_skill.envs.tasks.InsertFlowerEnv(*args, robot_uids='floating_ability_hand_right', robot_init_qpos_noise=0.02, num_envs=1, reconfiguration_freq=None, **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Superclass for ManiSkill environments.

Parameters:
  • num_envs – number of parallel environments to run. By default this is 1, which means a CPU simulation is used. If greater than 1, then we initialize the GPU simulation setup. Note that not all environments are faster when simulated on the GPU due to limitations of GPU simulations. For example, environments with many moving objects are better simulated by parallelizing across CPUs.

  • obs_mode – observation mode to be used. Must be one of (“state”, “state_dict”, “none”, “sensor_data”, “rgb”, “depth”, “segmentation”, “rgbd”, “rgb+depth”, “rgb+depth+segmentation”, “rgb+segmentation”, “depth+segmentation”, “pointcloud”) The obs_mode is mostly for convenience to automatically optimize/setup all sensors/cameras for the given observation mode to render the correct data and try to ignore unnecessary rendering. For the most advanced use cases (e.g. you have 1 RGB only camera and 1 depth only camera)

  • reward_mode – reward mode to use. Must be one of (“normalized_dense”, “dense”, “sparse”, “none”). With “none” the reward returned is always 0

  • control_mode – control mode of the agent. “*” represents all registered controllers, and the action space will be a dict.

  • render_mode – render mode registered in @SUPPORTED_RENDER_MODES.

  • shader_dir (Optional[str]) –

    shader directory. Defaults to None. Setting this will override the shader used for all cameras in the environment. This is legacy behavior kept for backwards compatibility. The proper way to change the shaders used for cameras is to either change the environment code or pass in sensor_configs/human_render_camera_configs with the desired shaders.

    Previously the options are “default”, “rt”, “rt-fast”. “rt” means ray-tracing which results in more photorealistic renders but is slow, “rt-fast” is a lower quality but faster version of “rt”.

  • enable_shadow (bool) – whether to enable shadow for lights. Defaults to False.

  • sensor_configs (dict) – configurations of sensors to override any environment defaults. If the key is one of sensor names (e.g. a camera), the config value will be applied to the corresponding sensor. Otherwise, the value will be applied to all sensors (but overridden by sensor-specific values). For possible configurations see the documentation see the sensors documentation.

  • human_render_camera_configs (dict) – configurations of human rendering cameras to override any environment defaults. Similar usage as @sensor_configs.

  • viewer_camera_configs (dict) – configurations of the viewer camera in the GUI to override any environment defaults. Similar usage as @sensor_configs.

  • robot_uids (Union[str, BaseAgent, list[Union[str, BaseAgent]]]) – list of robots to instantiate and control in the environment.

  • sim_config (Union[SimConfig, dict]) – Configurations for simulation if used that override the environment defaults. If given a dictionary, it can just override specific attributes e.g. sim_config=dict(scene_config=dict(solver_iterations=25)). If passing in a SimConfig object, while typed, will override every attribute including the task defaults. Some environments define their own recommended default sim configurations via the self._default_sim_config attribute that generally should not be completely overriden.

  • reconfiguration_freq (int) – How frequently to call reconfigure when environment is reset via self.reset(…) Generally for most users who are not building tasks this does not need to be changed. The default is 0, which means the environment reconfigures upon creation, and never again.

  • sim_backend (str) – By default this is “auto”. If sim_backend is “auto”, then if num_envs == 1, we use the PhysX CPU sim backend, otherwise we use the PhysX GPU sim backend and automatically pick a GPU to use. Can also be “physx_cpu” or “physx_cuda” to force usage of a particular sim backend. To select a particular GPU to run the simulation on, you can pass “physx_cuda:n” where n is the ID of the GPU, similar to the way PyTorch selects GPUs. Note that if this is “physx_cpu”, num_envs can only be equal to 1.

  • render_backend (str) –

    By default this is “gpu”. If render_backend is “gpu” or it’s alias “sapien_cuda”, then we auto select a GPU to render with. It can be “sapien_cuda:n” where n is the ID of the GPU to render with. If this is “cpu” or “sapien_cpu”, then we try to render on the CPU. If this is “none” or None, then we disable rendering.

    Note that some environments may require rendering functionalities to work. Moreover it is sometimes difficult to determine before running an environment if your machine can render or not. If you encounter some issue with rendering you can first try to double check your NVIDIA drivers / Vulkan drivers are setup correctly. If you don’t need to do rendering you can simply disable it by setting render_backend to “none” or None.

  • parallel_in_single_scene (bool) – By default this is False. If True, rendered images and the GUI will show all objects in one view. This is only really useful for generating cool videos showing all environments at once but it is not recommended otherwise as it slows down simulation and rendering.

  • enhanced_determinism (bool) – By default this is False and env resets will reset the episode RNG only when a seed / seed list is given. If True, the environment will reset the episode RNG upon each reset regardless of whether a seed is provided. Generally enhanced_determinisim is not needed and users are recommended to pass seeds into the env reset function instead.

_after_reconfigure(options)[source]#

Add code here that should run immediately after self._reconfigure is called. The torch RNG context is still active so RNG is still seeded here by self._episode_seed. This is useful if you need to run something that only happens after reconfiguration but need the GPU initialized so that you can check e.g. collisons, poses etc.

Parameters:

options (dict) –

_get_obs_extra(info)[source]#

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

Parameters:

info (dict) –

_initialize_actors(env_idx)[source]#
Parameters:

env_idx (torch.Tensor) –

_initialize_agent(env_idx)[source]#
Parameters:

env_idx (torch.Tensor) –

_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) –

compute_dense_reward(obs, action, info)[source]#

Compute the dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

Return type:

float

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

evaluate(**kwargs)[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

Return type:

dict

_clearance = 0.003#
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#
agent: mani_skill.agents.robots.FloatingAbilityHandRight#
asset_path = 'Instance of pathlib.Path/tasks/oakink-v2/align_ds'#
flower_spawn_half_size = 0.05#
hand_init_height = 0.25#
robot_init_qpos_noise = 0.02#
target_area#
class mani_skill.envs.tasks.LiftPegUprightEnv(*args, robot_uids='panda', robot_init_qpos_noise=0.02, **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Task Description: A simple task where the objective is to move a peg laying on the table to any upright position on the table

Randomizations: - the peg’s xy position is randomized on top of a table in the region [0.1, 0.1] x [-0.1, -0.1]. It is placed flat along it’s length on the table

Success Conditions: - the absolute value of the peg’s y euler angle is within 0.08 of $pi$/2 and the z position of the peg is within 0.005 of its half-length (0.12).

_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) –

compute_dense_reward(obs, action, info)[source]#

Compute the dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

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

SUPPORTED_ROBOTS = ['panda', 'fetch']#

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

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

agent: mani_skill.agents.robots.Panda | mani_skill.agents.robots.Fetch#
peg_half_length = 0.12#
peg_half_width = 0.025#
robot_init_qpos_noise = 0.02#
class mani_skill.envs.tasks.OpenCabinetDoorEnv(*args, robot_uids='fetch', robot_init_qpos_noise=0.02, reconfiguration_freq=None, num_envs=1, **kwargs)[source]#

Bases: OpenCabinetDrawerEnv

Task Description: Use the Fetch mobile manipulation robot to move towards a target cabinet and open the target drawer out.

Randomizations: - Robot is randomly initialized 1.6 to 1.8 meters away from the cabinet and positioned to face it - Robot’s base orientation is randomized by -9 to 9 degrees - The cabinet selected to manipulate is randomly sampled from all PartnetMobility cabinets that have drawers - The drawer to open is randomly sampled from all drawers available to open

Success Conditions: - The drawer is open at least 90% of the way, and the angular/linear velocities of the drawer link are small

Goal Specification: - 3D goal position centered at the center of mass of the handle mesh on the drawer to open (also visualized in human renders with a sphere).

TRAIN_JSON#
handle_types = ['revolute', 'revolute_unwrapped']#
class mani_skill.envs.tasks.OpenCabinetDrawerEnv(*args, robot_uids='fetch', robot_init_qpos_noise=0.02, reconfiguration_freq=None, num_envs=1, **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Task Description: Use the Fetch mobile manipulation robot to move towards a target cabinet and open the target drawer out.

Randomizations: - Robot is randomly initialized 1.6 to 1.8 meters away from the cabinet and positioned to face it - Robot’s base orientation is randomized by -9 to 9 degrees - The cabinet selected to manipulate is randomly sampled from all PartnetMobility cabinets that have drawers - The drawer to open is randomly sampled from all drawers available to open

Success Conditions: - The drawer is open at least 90% of the way, and the angular/linear velocities of the drawer link are small

Goal Specification: - 3D goal position centered at the center of mass of the handle mesh on the drawer to open (also visualized in human renders with a sphere).

_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.

_after_reconfigure(options)[source]#

Add code here that should run immediately after self._reconfigure is called. The torch RNG context is still active so RNG is still seeded here by self._episode_seed. This is useful if you need to run something that only happens after reconfiguration but need the GPU initialized so that you can check e.g. collisons, poses etc.

_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_cabinets(joint_types)[source]#
Parameters:

joint_types (list[str]) –

_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) –

compute_dense_reward(obs, action, info)[source]#

Compute the dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

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

Parameters:

env_idx (Optional[torch.Tensor]) –

SUPPORTED_ROBOTS = ['fetch']#

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

TRAIN_JSON#
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.Fetch#
all_model_ids#
handle_types = ['prismatic']#
min_open_frac = 0.75#
robot_init_qpos_noise = 0.02#
class mani_skill.envs.tasks.PegInsertionSideEnv(*args, robot_uids='panda_wristcam', num_envs=1, reconfiguration_freq=None, **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Task Description: Pick up a orange-white peg and insert the orange end into the box with a hole in it.

Randomizations: - Peg half length is randomized between 0.085 and 0.125 meters. Box half length is the same value. (during reconfiguration) - Peg radius/half-width is randomized between 0.015 and 0.025 meters. Box hole’s radius is same value + 0.003m of clearance. (during reconfiguration) - Peg is laid flat on table and has it’s xy position and z-axis rotation randomized - Box is laid flat on table and has it’s xy position and z-axis rotation randomized

Success Conditions: - The white end of the peg is within 0.015m of the center of the box (inserted mid way).

_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) –

compute_dense_reward(obs, action, info)[source]#

Compute the dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

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

has_peg_inserted()[source]#
SUPPORTED_ROBOTS = ['panda_wristcam']#

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

_clearance = 0.003#
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.PandaWristCam#
property box_hole_pose#
property goal_pose#
property peg_head_pos#
property peg_head_pose#
class mani_skill.envs.tasks.PickClutterYCBEnv(*args, robot_uids='panda', robot_init_qpos_noise=0.02, num_envs=1, reconfiguration_freq=None, episode_json=None, **kwargs)[source]#

Bases: PickClutterEnv

Base environment picking items out of clutter type of tasks. Flexibly supports using different configurations and object datasets

Parameters:

episode_json (str) –

_load_model(model_id)[source]#
DEFAULT_EPISODE_JSON = 'Instance of pathlib.Path/tasks/pick_clutter/ycb_train_5k.json.gz'#

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

class mani_skill.envs.tasks.PickCubeEnv(*args, robot_uids='panda', robot_init_qpos_noise=0.02, **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Superclass for ManiSkill environments.

Parameters:
  • num_envs – number of parallel environments to run. By default this is 1, which means a CPU simulation is used. If greater than 1, then we initialize the GPU simulation setup. Note that not all environments are faster when simulated on the GPU due to limitations of GPU simulations. For example, environments with many moving objects are better simulated by parallelizing across CPUs.

  • obs_mode – observation mode to be used. Must be one of (“state”, “state_dict”, “none”, “sensor_data”, “rgb”, “depth”, “segmentation”, “rgbd”, “rgb+depth”, “rgb+depth+segmentation”, “rgb+segmentation”, “depth+segmentation”, “pointcloud”) The obs_mode is mostly for convenience to automatically optimize/setup all sensors/cameras for the given observation mode to render the correct data and try to ignore unnecessary rendering. For the most advanced use cases (e.g. you have 1 RGB only camera and 1 depth only camera)

  • reward_mode – reward mode to use. Must be one of (“normalized_dense”, “dense”, “sparse”, “none”). With “none” the reward returned is always 0

  • control_mode – control mode of the agent. “*” represents all registered controllers, and the action space will be a dict.

  • render_mode – render mode registered in @SUPPORTED_RENDER_MODES.

  • shader_dir (Optional[str]) –

    shader directory. Defaults to None. Setting this will override the shader used for all cameras in the environment. This is legacy behavior kept for backwards compatibility. The proper way to change the shaders used for cameras is to either change the environment code or pass in sensor_configs/human_render_camera_configs with the desired shaders.

    Previously the options are “default”, “rt”, “rt-fast”. “rt” means ray-tracing which results in more photorealistic renders but is slow, “rt-fast” is a lower quality but faster version of “rt”.

  • enable_shadow (bool) – whether to enable shadow for lights. Defaults to False.

  • sensor_configs (dict) – configurations of sensors to override any environment defaults. If the key is one of sensor names (e.g. a camera), the config value will be applied to the corresponding sensor. Otherwise, the value will be applied to all sensors (but overridden by sensor-specific values). For possible configurations see the documentation see the sensors documentation.

  • human_render_camera_configs (dict) – configurations of human rendering cameras to override any environment defaults. Similar usage as @sensor_configs.

  • viewer_camera_configs (dict) – configurations of the viewer camera in the GUI to override any environment defaults. Similar usage as @sensor_configs.

  • robot_uids (Union[str, BaseAgent, list[Union[str, BaseAgent]]]) – list of robots to instantiate and control in the environment.

  • sim_config (Union[SimConfig, dict]) – Configurations for simulation if used that override the environment defaults. If given a dictionary, it can just override specific attributes e.g. sim_config=dict(scene_config=dict(solver_iterations=25)). If passing in a SimConfig object, while typed, will override every attribute including the task defaults. Some environments define their own recommended default sim configurations via the self._default_sim_config attribute that generally should not be completely overriden.

  • reconfiguration_freq (int) – How frequently to call reconfigure when environment is reset via self.reset(…) Generally for most users who are not building tasks this does not need to be changed. The default is 0, which means the environment reconfigures upon creation, and never again.

  • sim_backend (str) – By default this is “auto”. If sim_backend is “auto”, then if num_envs == 1, we use the PhysX CPU sim backend, otherwise we use the PhysX GPU sim backend and automatically pick a GPU to use. Can also be “physx_cpu” or “physx_cuda” to force usage of a particular sim backend. To select a particular GPU to run the simulation on, you can pass “physx_cuda:n” where n is the ID of the GPU, similar to the way PyTorch selects GPUs. Note that if this is “physx_cpu”, num_envs can only be equal to 1.

  • render_backend (str) –

    By default this is “gpu”. If render_backend is “gpu” or it’s alias “sapien_cuda”, then we auto select a GPU to render with. It can be “sapien_cuda:n” where n is the ID of the GPU to render with. If this is “cpu” or “sapien_cpu”, then we try to render on the CPU. If this is “none” or None, then we disable rendering.

    Note that some environments may require rendering functionalities to work. Moreover it is sometimes difficult to determine before running an environment if your machine can render or not. If you encounter some issue with rendering you can first try to double check your NVIDIA drivers / Vulkan drivers are setup correctly. If you don’t need to do rendering you can simply disable it by setting render_backend to “none” or None.

  • parallel_in_single_scene (bool) – By default this is False. If True, rendered images and the GUI will show all objects in one view. This is only really useful for generating cool videos showing all environments at once but it is not recommended otherwise as it slows down simulation and rendering.

  • enhanced_determinism (bool) – By default this is False and env resets will reset the episode RNG only when a seed / seed list is given. If True, the environment will reset the episode RNG upon each reset regardless of whether a seed is provided. Generally enhanced_determinisim is not needed and users are recommended to pass seeds into the env reset function instead.

_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) –

compute_dense_reward(obs, action, info)[source]#

Compute the dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

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

SUPPORTED_ROBOTS = ['panda', 'fetch', 'xarm6_robotiq', 'so100', 'widowxai']#

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

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

agent: mani_skill.agents.robots.Panda | mani_skill.agents.robots.Fetch | mani_skill.agents.robots.XArm6Robotiq | mani_skill.agents.robots.SO100 | mani_skill.agents.robots.WidowXAI#
cube_half_size = 0.02#
cube_spawn_center = (0, 0)#
cube_spawn_half_size = 0.05#
goal_thresh = 0.025#
human_cam_eye_pos = [0.6, 0.7, 0.6]#
human_cam_target_pos = [0.0, 0.0, 0.35]#
max_goal_height = 0.3#
robot_init_qpos_noise = 0.02#
sensor_cam_eye_pos = [0.3, 0, 0.6]#
sensor_cam_target_pos#
class mani_skill.envs.tasks.PickSingleYCBEnv(*args, robot_uids='panda_wristcam', robot_init_qpos_noise=0.02, num_envs=1, reconfiguration_freq=None, **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Task Description: Pick up a random object sampled from the [YCB dataset](https://www.ycbbenchmarks.com/) and move it to a random goal position

Randomizations: - the object’s xy position is randomized on top of a table in the region [0.1, 0.1] x [-0.1, -0.1]. It is placed flat on the table - the object’s z-axis rotation is randomized - the object geometry is randomized by randomly sampling any YCB object. (during reconfiguration)

Success Conditions: - the object position is within goal_thresh (default 0.025) euclidean distance of the goal position - the robot is static (q velocity < 0.2)

Goal Specification: - 3D goal position (also visualized in human renders)

Additional Notes - On GPU simulation, in order to collect data from every possible object in the YCB database we recommend using at least 128 parallel environments or more, otherwise you will need to reconfigure in order to sample new objects.

_after_reconfigure(options)[source]#

Add code here that should run immediately after self._reconfigure is called. The torch RNG context is still active so RNG is still seeded here by self._episode_seed. This is useful if you need to run something that only happens after reconfiguration but need the GPU initialized so that you can check e.g. collisons, poses etc.

Parameters:

options (dict) –

_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) –

compute_dense_reward(obs, action, info)[source]#

Compute the dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

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

SUPPORTED_ROBOTS = ['panda', 'panda_wristcam', 'fetch']#

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.Panda | mani_skill.agents.robots.panda.panda_wristcam.PandaWristCam | mani_skill.agents.robots.fetch.fetch.Fetch#
all_model_ids#
goal_thresh = 0.025#
model_id = None#
robot_init_qpos_noise = 0.02#
class mani_skill.envs.tasks.PlaceSphereEnv(*args, robot_uids='panda', robot_init_qpos_noise=0.02, **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Task Description: Place the sphere into the shallow bin.

Randomizations: - The position of the bin and the sphere are randomized: The bin is initialized in [0, 0.1] x [-0.1, 0.1], and the sphere is initialized in [-0.1, -0.05] x [-0.1, 0.1]

Success Conditions: - The sphere is placed on the top of the bin. The robot remains static and the gripper is not closed at the end state.

_build_bin(radius)[source]#
_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) –

compute_dense_reward(obs, action, info)[source]#

Compute the dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

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

SUPPORTED_ROBOTS = ['panda', 'fetch']#

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 | mani_skill.agents.robots.Fetch#
block_half_size#
edge_block_half_size#
inner_side_half_len = 0.02#
radius = 0.02#
robot_init_qpos_noise = 0.02#
short_side_half_size = 0.0025#
class mani_skill.envs.tasks.PlugChargerEnv(*args, robot_uids='panda_wristcam', robot_init_qpos_noise=0.02, **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Task Description: The robot must pick up one of the misplaced shapes on the board/kit and insert it into the correct empty slot.

Randomizations: - The charger position is randomized on the XY plane on top of the table. The rotation is also randomized - The receptacle position is randomized on the XY plane and the rotation is also randomized. Note that the human render camera has its pose fixed relative to the receptacle.

Success Conditions: - The charger is inserted into the receptacle

_build_charger(peg_size, base_size, gap)[source]#
_build_receptacle(peg_size, receptacle_size, gap)[source]#
_compute_distance()[source]#
_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

SUPPORTED_REWARD_MODES = ['none', 'sparse']#
SUPPORTED_ROBOTS = ['panda_wristcam']#

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

_base_size = [0.02, 0.015, 0.012]#
_clearance = 0.0005#
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#
_peg_gap = 0.007#
_peg_size = [0.008, 0.00075, 0.0032]#
_receptacle_size = [0.01, 0.05, 0.05]#

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

agent: mani_skill.agents.robots.PandaWristCam#
property charger_base_pose#
robot_init_qpos_noise = 0.02#
class mani_skill.envs.tasks.PokeCubeEnv(*args, robot_uids='panda', robot_init_qpos_noise=0.02, **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Task Description: A simple task where the objective is to poke a red cube with a peg and push it to a target goal position.

Randomizations: - the peg’s xy position is randomized on top of a table in the region [0.1, 0.1] x [-0.1, -0.1]. It is placed flat along it’s length on the table - the cube’s x-coordinate is fixed to peg’s x-coordinate + peg half-length (0.12) + 0.1 and y-coordinate is randomized in range [-0.1, 0.1]. It is placed flat on the table - the cube’s z-axis rotation is randomized in range [-$pi$/ 6, $pi$ / 6] - the target goal region is marked by a red/white circular target. The position of the target is fixed to be the cube xy position + [0.05 + goal_radius, 0]

Success Conditions: - the cube’s xy position is within goal_radius (default 0.05) of the target’s xy position by euclidean distance - the robot is static

_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) –

compute_dense_reward(obs, action, info)[source]#

Compute the dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

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

SUPPORTED_ROBOTS = ['panda', 'fetch']#

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

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

agent: mani_skill.agents.robots.Panda | mani_skill.agents.robots.Fetch#
cube_half_size = 0.02#
goal_radius = 0.05#
peg_half_length = 0.12#
peg_half_width = 0.025#
property peg_head_pos#
property peg_head_pose#
robot_init_qpos_noise = 0.02#
class mani_skill.envs.tasks.PullCubeEnv(*args, robot_uids='panda', robot_init_qpos_noise=0.02, **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Task Description: A simple task where the objective is to pull a cube onto a target.

Randomizations: - the cube’s xy position is randomized on top of a table in the region [0.1, 0.1] x [-0.1, -0.1]. - the target goal region is marked by a red and white target. The position of the target is fixed to be the cube’s xy position - [0.1 + goal_radius, 0]

Success Conditions: - the cube’s xy position is within goal_radius (default 0.1) of the target’s xy position by euclidean distance.

_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) –

compute_dense_reward(obs, action, info)[source]#

Compute the dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

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

SUPPORTED_ROBOTS = ['panda', 'fetch']#

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

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

agent: mani_skill.agents.robots.Panda | mani_skill.agents.robots.Fetch#
cube_half_size = 0.02#
goal_radius = 0.1#
robot_init_qpos_noise = 0.02#
class mani_skill.envs.tasks.PullCubeToolEnv(*args, robot_uids='panda', robot_init_qpos_noise=0.02, **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Task Description Given an L-shaped tool that is within the reach of the robot, leverage the tool to pull a cube that is out of it’s reach

Randomizations - The cube’s position (x,y) is randomized on top of a table in the region “<out of manipulator reach, but within reach of tool>”. It is placed flat on the table - The target goal region is the region on top of the table marked by “<within reach of arm>”

Success Conditions - The cube’s xy position is within the goal region of the arm’s base (marked by reachability)

_build_l_shaped_tool(handle_length, hook_length, width, height)[source]#
_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) –

compute_dense_reward(obs, action, info)[source]#

Compute the dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

compute_normalized_dense_reward(obs, action, info)[source]#

Normalizes the dense reward by the maximum possible reward (success bonus)

Parameters:
  • obs (Any) –

  • action (torch.Tensor) –

  • info (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

SUPPORTED_REWARD_MODES = ('normalized_dense', 'dense', 'sparse', 'none')#
SUPPORTED_ROBOTS = ['panda', 'fetch']#

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 | mani_skill.agents.robots.Fetch#
arm_reach = 0.35#
cube_half_size = 0.02#
cube_size = 0.02#
goal_radius = 0.3#
handle_length = 0.2#
height = 0.05#
hook_length = 0.05#
robot_init_qpos_noise = 0.02#
width = 0.05#
class mani_skill.envs.tasks.PushCubeEnv(*args, robot_uids='panda', robot_init_qpos_noise=0.02, **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Task Description: A simple task where the objective is to push and move a cube to a goal region in front of it

Randomizations: - the cube’s xy position is randomized on top of a table in the region [0.1, 0.1] x [-0.1, -0.1]. It is placed flat on the table - the target goal region is marked by a red/white circular target. The position of the target is fixed to be the cube xy position + [0.1 + goal_radius, 0]

Success Conditions: - the cube’s xy position is within goal_radius (default 0.1) of the target’s xy position by euclidean distance and the cube is still on the table.

_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) –

compute_dense_reward(obs, action, info)[source]#

Compute the dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

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

SUPPORTED_ROBOTS = ['panda', 'fetch']#

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 | mani_skill.agents.robots.Fetch#
cube_half_size = 0.02#
goal_radius = 0.1#
robot_init_qpos_noise = 0.02#
class mani_skill.envs.tasks.PushTEnv(*args, robot_uids='panda_stick', robot_init_qpos_noise=0.02, **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Task Description: A simulated version of the real-world push-T task from Diffusion Policy: https://diffusion-policy.cs.columbia.edu/

In this task, the robot needs to: 1. Precisely push the T-shaped block into the target region, and 2. Move the end-effector to the end-zone which terminates the episode. [2 Not required for PushT-easy-v1]

Randomizations: - 3D T block initial position on table [-1,1] x [-1,2] + T Goal initial position - 3D T block initial z rotation [0,2pi]

Success Conditions: - The T block covers 90% of the 2D goal T’s area

_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) –

compute_dense_reward(obs, action, info)[source]#

Compute the dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

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

pseudo_render_intersection()[source]#

‘pseudo render’ algo for calculating the intersection made custom ‘psuedo renderer’ to compute intersection area all computation in parallel on cuda, zero explicit loops views blocks in 2d in the goal tee frame to see overlap

quat_to_z_euler(quats)[source]#
quat_to_zrot(quats)[source]#
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

T_dynamic_friction = 3#
T_mass = 0.8#
T_static_friction = 3#
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.PandaStick#
ee_starting_pos2D#
ee_starting_pos3D#
goal_offset#
goal_z_rot#
intersection_thresh = 0.9#
robot_init_qpos_noise = 0.02#
tee_spawnbox_xlength = 0.2#
tee_spawnbox_xoffset = -0.1#
tee_spawnbox_ylength = 0.3#
tee_spawnbox_yoffset = -0.1#
class mani_skill.envs.tasks.PutCarrotOnPlateInScene(**kwargs)[source]#

Bases: mani_skill.envs.tasks.digital_twins.bridge_dataset_eval.base_env.BaseBridgeEnv

Base Digital Twin environment for digital twins of the BridgeData v2

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

get_language_instruction(**kwargs)[source]#
objects_excluded_from_greenscreening = ['bridge_carrot_generated_modified', 'bridge_plate_objaverse_larger']#

object ids that should not be greenscreened

scene_setting = 'flat_table'#
class mani_skill.envs.tasks.PutEggplantInBasketScene(**kwargs)[source]#

Bases: mani_skill.envs.tasks.digital_twins.bridge_dataset_eval.base_env.BaseBridgeEnv

Base Digital Twin environment for digital twins of the BridgeData v2

_load_lighting(options)[source]#

Loads lighting into the scene. Called by self._reconfigure. If not overriden will set some simple default lighting

evaluate(*args, **kwargs)[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

get_language_instruction(**kwargs)[source]#
objects_excluded_from_greenscreening = ['eggplant']#

object ids that should not be greenscreened

scene_setting = 'sink'#
class mani_skill.envs.tasks.PutSpoonOnTableClothInScene(**kwargs)[source]#

Bases: mani_skill.envs.tasks.digital_twins.bridge_dataset_eval.base_env.BaseBridgeEnv

Base Digital Twin environment for digital twins of the BridgeData v2

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

get_language_instruction(**kwargs)[source]#
objects_excluded_from_greenscreening = ['table_cloth_generated_shorter', 'bridge_spoon_generated_modified']#

object ids that should not be greenscreened

class mani_skill.envs.tasks.QuadrupedReachEnv(*args, robot_uids='anymal-c', **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Superclass for ManiSkill environments.

Parameters:
  • num_envs – number of parallel environments to run. By default this is 1, which means a CPU simulation is used. If greater than 1, then we initialize the GPU simulation setup. Note that not all environments are faster when simulated on the GPU due to limitations of GPU simulations. For example, environments with many moving objects are better simulated by parallelizing across CPUs.

  • obs_mode – observation mode to be used. Must be one of (“state”, “state_dict”, “none”, “sensor_data”, “rgb”, “depth”, “segmentation”, “rgbd”, “rgb+depth”, “rgb+depth+segmentation”, “rgb+segmentation”, “depth+segmentation”, “pointcloud”) The obs_mode is mostly for convenience to automatically optimize/setup all sensors/cameras for the given observation mode to render the correct data and try to ignore unnecessary rendering. For the most advanced use cases (e.g. you have 1 RGB only camera and 1 depth only camera)

  • reward_mode – reward mode to use. Must be one of (“normalized_dense”, “dense”, “sparse”, “none”). With “none” the reward returned is always 0

  • control_mode – control mode of the agent. “*” represents all registered controllers, and the action space will be a dict.

  • render_mode – render mode registered in @SUPPORTED_RENDER_MODES.

  • shader_dir (Optional[str]) –

    shader directory. Defaults to None. Setting this will override the shader used for all cameras in the environment. This is legacy behavior kept for backwards compatibility. The proper way to change the shaders used for cameras is to either change the environment code or pass in sensor_configs/human_render_camera_configs with the desired shaders.

    Previously the options are “default”, “rt”, “rt-fast”. “rt” means ray-tracing which results in more photorealistic renders but is slow, “rt-fast” is a lower quality but faster version of “rt”.

  • enable_shadow (bool) – whether to enable shadow for lights. Defaults to False.

  • sensor_configs (dict) – configurations of sensors to override any environment defaults. If the key is one of sensor names (e.g. a camera), the config value will be applied to the corresponding sensor. Otherwise, the value will be applied to all sensors (but overridden by sensor-specific values). For possible configurations see the documentation see the sensors documentation.

  • human_render_camera_configs (dict) – configurations of human rendering cameras to override any environment defaults. Similar usage as @sensor_configs.

  • viewer_camera_configs (dict) – configurations of the viewer camera in the GUI to override any environment defaults. Similar usage as @sensor_configs.

  • robot_uids (Union[str, BaseAgent, list[Union[str, BaseAgent]]]) – list of robots to instantiate and control in the environment.

  • sim_config (Union[SimConfig, dict]) – Configurations for simulation if used that override the environment defaults. If given a dictionary, it can just override specific attributes e.g. sim_config=dict(scene_config=dict(solver_iterations=25)). If passing in a SimConfig object, while typed, will override every attribute including the task defaults. Some environments define their own recommended default sim configurations via the self._default_sim_config attribute that generally should not be completely overriden.

  • reconfiguration_freq (int) – How frequently to call reconfigure when environment is reset via self.reset(…) Generally for most users who are not building tasks this does not need to be changed. The default is 0, which means the environment reconfigures upon creation, and never again.

  • sim_backend (str) – By default this is “auto”. If sim_backend is “auto”, then if num_envs == 1, we use the PhysX CPU sim backend, otherwise we use the PhysX GPU sim backend and automatically pick a GPU to use. Can also be “physx_cpu” or “physx_cuda” to force usage of a particular sim backend. To select a particular GPU to run the simulation on, you can pass “physx_cuda:n” where n is the ID of the GPU, similar to the way PyTorch selects GPUs. Note that if this is “physx_cpu”, num_envs can only be equal to 1.

  • render_backend (str) –

    By default this is “gpu”. If render_backend is “gpu” or it’s alias “sapien_cuda”, then we auto select a GPU to render with. It can be “sapien_cuda:n” where n is the ID of the GPU to render with. If this is “cpu” or “sapien_cpu”, then we try to render on the CPU. If this is “none” or None, then we disable rendering.

    Note that some environments may require rendering functionalities to work. Moreover it is sometimes difficult to determine before running an environment if your machine can render or not. If you encounter some issue with rendering you can first try to double check your NVIDIA drivers / Vulkan drivers are setup correctly. If you don’t need to do rendering you can simply disable it by setting render_backend to “none” or None.

  • parallel_in_single_scene (bool) – By default this is False. If True, rendered images and the GUI will show all objects in one view. This is only really useful for generating cool videos showing all environments at once but it is not recommended otherwise as it slows down simulation and rendering.

  • enhanced_determinism (bool) – By default this is False and env resets will reset the episode RNG only when a seed / seed list is given. If True, the environment will reset the episode RNG upon each reset regardless of whether a seed is provided. Generally enhanced_determinisim is not needed and users are recommended to pass seeds into the env reset function instead.

_compute_undesired_contacts(threshold=1.0)[source]#
_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) –

compute_dense_reward(obs, action, info)[source]#

Compute the dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

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

SUPPORTED_ROBOTS = ['anymal_c', 'unitree_go2_simplified_locomotion']#

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#
agent: mani_skill.agents.robots.anymal.anymal_c.ANYmalC#
default_qpos: torch.Tensor#
class mani_skill.envs.tasks.QuadrupedSpinEnv(*args, robot_uids='anymal-c', **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Superclass for ManiSkill environments.

Parameters:
  • num_envs – number of parallel environments to run. By default this is 1, which means a CPU simulation is used. If greater than 1, then we initialize the GPU simulation setup. Note that not all environments are faster when simulated on the GPU due to limitations of GPU simulations. For example, environments with many moving objects are better simulated by parallelizing across CPUs.

  • obs_mode – observation mode to be used. Must be one of (“state”, “state_dict”, “none”, “sensor_data”, “rgb”, “depth”, “segmentation”, “rgbd”, “rgb+depth”, “rgb+depth+segmentation”, “rgb+segmentation”, “depth+segmentation”, “pointcloud”) The obs_mode is mostly for convenience to automatically optimize/setup all sensors/cameras for the given observation mode to render the correct data and try to ignore unnecessary rendering. For the most advanced use cases (e.g. you have 1 RGB only camera and 1 depth only camera)

  • reward_mode – reward mode to use. Must be one of (“normalized_dense”, “dense”, “sparse”, “none”). With “none” the reward returned is always 0

  • control_mode – control mode of the agent. “*” represents all registered controllers, and the action space will be a dict.

  • render_mode – render mode registered in @SUPPORTED_RENDER_MODES.

  • shader_dir (Optional[str]) –

    shader directory. Defaults to None. Setting this will override the shader used for all cameras in the environment. This is legacy behavior kept for backwards compatibility. The proper way to change the shaders used for cameras is to either change the environment code or pass in sensor_configs/human_render_camera_configs with the desired shaders.

    Previously the options are “default”, “rt”, “rt-fast”. “rt” means ray-tracing which results in more photorealistic renders but is slow, “rt-fast” is a lower quality but faster version of “rt”.

  • enable_shadow (bool) – whether to enable shadow for lights. Defaults to False.

  • sensor_configs (dict) – configurations of sensors to override any environment defaults. If the key is one of sensor names (e.g. a camera), the config value will be applied to the corresponding sensor. Otherwise, the value will be applied to all sensors (but overridden by sensor-specific values). For possible configurations see the documentation see the sensors documentation.

  • human_render_camera_configs (dict) – configurations of human rendering cameras to override any environment defaults. Similar usage as @sensor_configs.

  • viewer_camera_configs (dict) – configurations of the viewer camera in the GUI to override any environment defaults. Similar usage as @sensor_configs.

  • robot_uids (Union[str, BaseAgent, list[Union[str, BaseAgent]]]) – list of robots to instantiate and control in the environment.

  • sim_config (Union[SimConfig, dict]) – Configurations for simulation if used that override the environment defaults. If given a dictionary, it can just override specific attributes e.g. sim_config=dict(scene_config=dict(solver_iterations=25)). If passing in a SimConfig object, while typed, will override every attribute including the task defaults. Some environments define their own recommended default sim configurations via the self._default_sim_config attribute that generally should not be completely overriden.

  • reconfiguration_freq (int) – How frequently to call reconfigure when environment is reset via self.reset(…) Generally for most users who are not building tasks this does not need to be changed. The default is 0, which means the environment reconfigures upon creation, and never again.

  • sim_backend (str) – By default this is “auto”. If sim_backend is “auto”, then if num_envs == 1, we use the PhysX CPU sim backend, otherwise we use the PhysX GPU sim backend and automatically pick a GPU to use. Can also be “physx_cpu” or “physx_cuda” to force usage of a particular sim backend. To select a particular GPU to run the simulation on, you can pass “physx_cuda:n” where n is the ID of the GPU, similar to the way PyTorch selects GPUs. Note that if this is “physx_cpu”, num_envs can only be equal to 1.

  • render_backend (str) –

    By default this is “gpu”. If render_backend is “gpu” or it’s alias “sapien_cuda”, then we auto select a GPU to render with. It can be “sapien_cuda:n” where n is the ID of the GPU to render with. If this is “cpu” or “sapien_cpu”, then we try to render on the CPU. If this is “none” or None, then we disable rendering.

    Note that some environments may require rendering functionalities to work. Moreover it is sometimes difficult to determine before running an environment if your machine can render or not. If you encounter some issue with rendering you can first try to double check your NVIDIA drivers / Vulkan drivers are setup correctly. If you don’t need to do rendering you can simply disable it by setting render_backend to “none” or None.

  • parallel_in_single_scene (bool) – By default this is False. If True, rendered images and the GUI will show all objects in one view. This is only really useful for generating cool videos showing all environments at once but it is not recommended otherwise as it slows down simulation and rendering.

  • enhanced_determinism (bool) – By default this is False and env resets will reset the episode RNG only when a seed / seed list is given. If True, the environment will reset the episode RNG upon each reset regardless of whether a seed is provided. Generally enhanced_determinisim is not needed and users are recommended to pass seeds into the env reset function instead.

_compute_undesired_contacts(threshold=1.0)[source]#
_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) –

compute_dense_reward(obs, action, info)[source]#

Compute the dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

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

SUPPORTED_ROBOTS = ['anymal_c', 'unitree_go2_simplified_locomotion']#

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#
agent: mani_skill.agents.robots.anymal.anymal_c.ANYmalC#
default_qpos: torch.Tensor#
class mani_skill.envs.tasks.RoboCasaKitchenEnv(*args, robot_uids='fetch', env_configuration='default', controller_configs=None, gripper_types='default', base_types='default', initialization_noise='default', use_camera_obs=True, use_object_obs=True, reward_scale=1.0, reward_shaping=False, placement_initializer=None, has_renderer=False, has_offscreen_renderer=True, render_camera='robot0_agentview_center', render_collision_mesh=False, render_visual_mesh=True, render_gpu_device_id=-1, control_freq=20, horizon=1000, ignore_done=False, camera_names='agentview', camera_heights=256, camera_widths=256, camera_depths=False, renderer='mujoco', renderer_config=None, init_robot_base_pos=None, seed=None, layout_and_style_ids=None, layout_ids=None, style_ids=None, scene_split=None, generative_textures=None, obj_registries=('objaverse',), obj_instance_split=None, use_distractors=False, translucent_robot=False, randomize_cameras=False, fixtures_only=False, **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Superclass for ManiSkill environments.

Parameters:
  • num_envs – number of parallel environments to run. By default this is 1, which means a CPU simulation is used. If greater than 1, then we initialize the GPU simulation setup. Note that not all environments are faster when simulated on the GPU due to limitations of GPU simulations. For example, environments with many moving objects are better simulated by parallelizing across CPUs.

  • obs_mode – observation mode to be used. Must be one of (“state”, “state_dict”, “none”, “sensor_data”, “rgb”, “depth”, “segmentation”, “rgbd”, “rgb+depth”, “rgb+depth+segmentation”, “rgb+segmentation”, “depth+segmentation”, “pointcloud”) The obs_mode is mostly for convenience to automatically optimize/setup all sensors/cameras for the given observation mode to render the correct data and try to ignore unnecessary rendering. For the most advanced use cases (e.g. you have 1 RGB only camera and 1 depth only camera)

  • reward_mode – reward mode to use. Must be one of (“normalized_dense”, “dense”, “sparse”, “none”). With “none” the reward returned is always 0

  • control_mode – control mode of the agent. “*” represents all registered controllers, and the action space will be a dict.

  • render_mode – render mode registered in @SUPPORTED_RENDER_MODES.

  • shader_dir (Optional[str]) –

    shader directory. Defaults to None. Setting this will override the shader used for all cameras in the environment. This is legacy behavior kept for backwards compatibility. The proper way to change the shaders used for cameras is to either change the environment code or pass in sensor_configs/human_render_camera_configs with the desired shaders.

    Previously the options are “default”, “rt”, “rt-fast”. “rt” means ray-tracing which results in more photorealistic renders but is slow, “rt-fast” is a lower quality but faster version of “rt”.

  • enable_shadow (bool) – whether to enable shadow for lights. Defaults to False.

  • sensor_configs (dict) – configurations of sensors to override any environment defaults. If the key is one of sensor names (e.g. a camera), the config value will be applied to the corresponding sensor. Otherwise, the value will be applied to all sensors (but overridden by sensor-specific values). For possible configurations see the documentation see the sensors documentation.

  • human_render_camera_configs (dict) – configurations of human rendering cameras to override any environment defaults. Similar usage as @sensor_configs.

  • viewer_camera_configs (dict) – configurations of the viewer camera in the GUI to override any environment defaults. Similar usage as @sensor_configs.

  • robot_uids (Union[str, BaseAgent, list[Union[str, BaseAgent]]]) – list of robots to instantiate and control in the environment.

  • sim_config (Union[SimConfig, dict]) – Configurations for simulation if used that override the environment defaults. If given a dictionary, it can just override specific attributes e.g. sim_config=dict(scene_config=dict(solver_iterations=25)). If passing in a SimConfig object, while typed, will override every attribute including the task defaults. Some environments define their own recommended default sim configurations via the self._default_sim_config attribute that generally should not be completely overriden.

  • reconfiguration_freq (int) – How frequently to call reconfigure when environment is reset via self.reset(…) Generally for most users who are not building tasks this does not need to be changed. The default is 0, which means the environment reconfigures upon creation, and never again.

  • sim_backend (str) – By default this is “auto”. If sim_backend is “auto”, then if num_envs == 1, we use the PhysX CPU sim backend, otherwise we use the PhysX GPU sim backend and automatically pick a GPU to use. Can also be “physx_cpu” or “physx_cuda” to force usage of a particular sim backend. To select a particular GPU to run the simulation on, you can pass “physx_cuda:n” where n is the ID of the GPU, similar to the way PyTorch selects GPUs. Note that if this is “physx_cpu”, num_envs can only be equal to 1.

  • render_backend (str) –

    By default this is “gpu”. If render_backend is “gpu” or it’s alias “sapien_cuda”, then we auto select a GPU to render with. It can be “sapien_cuda:n” where n is the ID of the GPU to render with. If this is “cpu” or “sapien_cpu”, then we try to render on the CPU. If this is “none” or None, then we disable rendering.

    Note that some environments may require rendering functionalities to work. Moreover it is sometimes difficult to determine before running an environment if your machine can render or not. If you encounter some issue with rendering you can first try to double check your NVIDIA drivers / Vulkan drivers are setup correctly. If you don’t need to do rendering you can simply disable it by setting render_backend to “none” or None.

  • parallel_in_single_scene (bool) – By default this is False. If True, rendered images and the GUI will show all objects in one view. This is only really useful for generating cool videos showing all environments at once but it is not recommended otherwise as it slows down simulation and rendering.

  • enhanced_determinism (bool) – By default this is False and env resets will reset the episode RNG only when a seed / seed list is given. If True, the environment will reset the episode RNG upon each reset regardless of whether a seed is provided. Generally enhanced_determinisim is not needed and users are recommended to pass seeds into the env reset function instead.

_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) –

_setup_kitchen_references()[source]#

setup fixtures (and their references). this function is called within load_model function for kitchens

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

register_fixture_ref(ref_name, fn_kwargs)[source]#

Registers a fixture reference for later use. Initializes the fixture if it has not been initialized yet.

Parameters:
  • ref_name (str) – name of the reference

  • fn_kwargs (dict) – keyword arguments to pass to get_fixture

Returns:

fixture object

Return type:

Fixture

sample_object(groups, exclude_groups=None, graspable=None, microwavable=None, washable=None, cookable=None, freezable=None, split=None, obj_registries=None, max_size=(None, None, None), object_scale=None, rng=None)[source]#

Sample a kitchen object from the specified groups and within max_size bounds.

Parameters:
  • groups (list or str) – groups to sample from or the exact xml path of the object to spawn

  • exclude_groups (str or list) – groups to exclude

  • graspable (bool) – whether the sampled object must be graspable

  • washable (bool) – whether the sampled object must be washable

  • microwavable (bool) – whether the sampled object must be microwavable

  • cookable (bool) – whether whether the sampled object must be cookable

  • freezable (bool) – whether whether the sampled object must be freezable

  • split (str) – split to sample from. Split “A” specifies all but the last 3 object instances (or the first half - whichever is larger), “B” specifies the rest, and None specifies all.

  • obj_registries (tuple) – registries to sample from

  • max_size (tuple) – max size of the object. If the sampled object is not within bounds of max size, function will resample

  • object_scale (float) – scale of the object. If set will multiply the scale of the sampled object by this value

Returns:

kwargs to apply to the MJCF model for the sampled object

dict: info about the sampled object - the path of the mjcf, groups which the object’s category belongs to, the category of the object the sampling split the object came from, and the groups the object was sampled from

Return type:

dict

EXCLUDE_LAYOUTS = []#
SUPPORTED_REWARD_MODES = ['none']#

Initialized a Base Kitchen environment.

Parameters:
  • robots – Specification for specific robot arm(s) to be instantiated within this env (e.g: “Sawyer” would generate one arm; [“Panda”, “Panda”, “Sawyer”] would generate three robot arms)

  • env_configuration (str) – Specifies how to position the robot(s) within the environment. Default is “default”, which should be interpreted accordingly by any subclasses.

  • controller_configs (str or list of dict) – If set, contains relevant controller parameters for creating a custom controller. Else, uses the default controller for this specific task. Should either be single dict if same controller is to be used for all robots or else it should be a list of the same length as “robots” param

  • base_types (None or str or list of str) – type of base, used to instantiate base models from base factory. Default is “default”, which is the default base associated with the robot(s) the ‘robots’ specification. None results in no base, and any other (valid) model overrides the default base. Should either be single str if same base type is to be used for all robots or else it should be a list of the same length as “robots” param

  • gripper_types (None or str or list of str) – type of gripper, used to instantiate gripper models from gripper factory. Default is “default”, which is the default grippers(s) associated with the robot(s) the ‘robots’ specification. None removes the gripper, and any other (valid) model overrides the default gripper. Should either be single str if same gripper type is to be used for all robots or else it should be a list of the same length as “robots” param

  • initialization_noise (dict or list of dict) –

    dict containing the initialization noise parameters. The expected keys and corresponding value types are specified below:

    ’magnitude’:

    The scale factor of uni-variate random noise applied to each of a robot’s given initial joint positions. Setting this value to None or 0.0 results in no noise being applied. If “gaussian” type of noise is applied then this magnitude scales the standard deviation applied, If “uniform” type of noise is applied then this magnitude sets the bounds of the sampling range

    ’type’:

    Type of noise to apply. Can either specify “gaussian” or “uniform”

    Should either be single dict if same noise value is to be used for all robots or else it should be a list of the same length as “robots” param

    Note:

    Specifying “default” will automatically use the default noise settings. Specifying None will automatically create the required dict with “magnitude” set to 0.0.

  • use_camera_obs (bool) – if True, every observation includes rendered image(s)

  • placement_initializer (ObjectPositionSampler) – if provided, will be used to place objects on every reset, else a UniformRandomSampler is used by default.

  • has_renderer (bool) – If true, render the simulation state in a viewer instead of headless mode.

  • has_offscreen_renderer (bool) – True if using off-screen rendering

  • render_camera (str) – Name of camera to render if has_renderer is True. Setting this value to ‘None’ will result in the default angle being applied, which is useful as it can be dragged / panned by the user using the mouse

  • render_collision_mesh (bool) – True if rendering collision meshes in camera. False otherwise.

  • render_visual_mesh (bool) – True if rendering visual meshes in camera. False otherwise.

  • render_gpu_device_id (int) – corresponds to the GPU device id to use for offscreen rendering. Defaults to -1, in which case the device will be inferred from environment variables (GPUS or CUDA_VISIBLE_DEVICES).

  • control_freq (float) – how many control signals to receive in every second. This sets the abase of simulation time that passes between every action input.

  • horizon (int) – Every episode lasts for exactly @horizon timesteps.

  • ignore_done (bool) – True if never terminating the environment (ignore @horizon).

  • camera_names (str or list of str) –

    name of camera to be rendered. Should either be single str if same name is to be used for all cameras’ rendering or else it should be a list of cameras to render.

    Note:

    At least one camera must be specified if @use_camera_obs is True.

    Note:

    To render all robots’ cameras of a certain type (e.g.: “robotview” or “eye_in_hand”), use the convention “all-{name}” (e.g.: “all-robotview”) to automatically render all camera images from each robot’s camera list).

  • camera_heights (int or list of int) – height of camera frame. Should either be single int if same height is to be used for all cameras’ frames or else it should be a list of the same length as “camera names” param.

  • camera_widths (int or list of int) – width of camera frame. Should either be single int if same width is to be used for all cameras’ frames or else it should be a list of the same length as “camera names” param.

  • camera_depths (bool or list of bool) – True if rendering RGB-D, and RGB otherwise. Should either be single bool if same depth setting is to be used for all cameras or else it should be a list of the same length as “camera names” param.

  • renderer (str) – Specifies which renderer to use.

  • renderer_config (dict) – dictionary for the renderer configurations

  • init_robot_base_pos (str) – name of the fixture to place the near. If None, will randomly select a fixture.

  • seed (int) – environment seed. Default is None, where environment is unseeded, ie. random

  • layout_and_style_ids (list of list of int) – list of layout and style ids to use for the kitchen.

  • layout_ids ((list of) LayoutType or int) – layout id(s) to use for the kitchen. -1 and None specify all layouts -2 specifies layouts not involving islands/wall stacks, -3 specifies layouts involving islands/wall stacks, -4 specifies layouts with dining areas.

  • style_ids ((list of) StyleType or int) – style id(s) to use for the kitchen. -1 and None specify all styles.

  • generative_textures (str) – if set to “100p”, will use AI generated textures

  • obj_registries (tuple of str) – tuple containing the object registries to use for sampling objects. can contain “objaverse” and/or “aigen” to sample objects from objaverse, AI generated, or both.

  • obj_instance_split (str) – string for specifying a custom set of object instances to use. “A” specifies all but the last 3 object instances (or the first half - whichever is larger), “B” specifies the rest, and None specifies all.

  • use_distractors (bool) – if True, will add distractor objects to the scene

  • translucent_robot (bool) – if True, will make the robot appear translucent during rendering

  • randomize_cameras (bool) – if True, will add gaussian noise to the position and rotation of the wrist and agentview cameras

SUPPORTED_ROBOTS = ['fetch', 'none']#

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#
property _default_viewer_camera_config#
_ep_meta#
fixtures_only = False#
generative_textures = None#
init_robot_base_pos = None#
layout_and_style_ids#
obj_instance_split = None#
obj_registries = ('objaverse',)#
placement_initializer = None#
randomize_cameras = False#
reward_scale = 1.0#
reward_shaping = False#
translucent_robot = False#
use_distractors = False#
use_object_obs = True#
class mani_skill.envs.tasks.RollBallEnv(*args, robot_uids='panda', robot_init_qpos_noise=0.02, **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Task Description: A simple task where the objective is to push and roll a ball to a goal region at the other end of the table

Randomizations: - The ball’s xy position is randomized on top of a table in the region [0.2, 0.5] x [-0.4, 0.7]. It is placed flat on the table - The target goal region is marked by a red/white circular target. The position of the target is randomized on top of a table in the region [-0.4, -0.7] x [0.2, -0.9]

Success Conditions: - The ball’s xy position is within goal_radius (default 0.1) of the target’s xy position by euclidean distance.

_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) –

compute_dense_reward(obs, action, info)[source]#

Compute the dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

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

SUPPORTED_ROBOTS = ['panda']#

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#
ball_radius: float = 0.035#
goal_radius: float = 0.1#
reached_status: torch.Tensor#
robot_init_qpos_noise = 0.02#
class mani_skill.envs.tasks.RotateCubeEnv(*args, robot_uids='trifingerpro', robot_init_qpos_noise=0.02, difficulty_level=4, **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Modified from NVIDIA-Omniverse/IsaacGymEnvs NVIDIA-Omniverse/IsaacGymEnvs

Parameters:

difficulty_level (int) –

_get_obs_extra(info)[source]#

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

Parameters:

info (dict) –

_initialize_actors(env_idx)[source]#
Parameters:

env_idx (torch.Tensor) –

_initialize_agent(env_idx)[source]#
Parameters:

env_idx (torch.Tensor) –

_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) –

_sample_object_goal_poses(env_idx, difficulty)[source]#

Sample goal poses for the cube and sets them into the desired goal pose buffer.

Parameters:
  • instances – A tensor constraining indices of environment instances to reset.

  • difficulty (int) – Difficulty level. The higher, the more difficult is the goal.

  • env_idx (torch.Tensor) –

Possible levels are:
  • 0: Random goal position on the table, no orientation.

  • 1: Random goal position on the table, including yaw orientation.

  • 2: Fixed goal position in the air with x,y = 0. No orientation.

  • 3: Random goal position in the air, no orientation.

  • 4: Random goal pose in the air, including orientation.

compute_dense_reward(obs, action, info)[source]#

Compute the dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

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

ARENA_RADIUS = 0.195#
SUPPORTED_ROBOTS = ['trifingerpro']#

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

agent: mani_skill.agents.robots.TriFingerPro#
cube_half_size = 0.02#
difficulty_level = 4#
goal_radius = 0.02#
max_com_distance_to_center#
max_height = 0.1#
max_len = 0.065#
min_height = 0.0325#
radius_3d#
robot_init_qpos_noise = 0.02#
sim_config#

the final sim config after merging user overrides with the environment default

size = 0.065#
class mani_skill.envs.tasks.RotateSingleObjectInHand(*args, robot_init_qpos_noise=0.02, obj_init_pos_noise=0.02, difficulty_level=-1, num_envs=1, reconfiguration_freq=None, **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Superclass for ManiSkill environments.

Parameters:
  • num_envs – number of parallel environments to run. By default this is 1, which means a CPU simulation is used. If greater than 1, then we initialize the GPU simulation setup. Note that not all environments are faster when simulated on the GPU due to limitations of GPU simulations. For example, environments with many moving objects are better simulated by parallelizing across CPUs.

  • obs_mode – observation mode to be used. Must be one of (“state”, “state_dict”, “none”, “sensor_data”, “rgb”, “depth”, “segmentation”, “rgbd”, “rgb+depth”, “rgb+depth+segmentation”, “rgb+segmentation”, “depth+segmentation”, “pointcloud”) The obs_mode is mostly for convenience to automatically optimize/setup all sensors/cameras for the given observation mode to render the correct data and try to ignore unnecessary rendering. For the most advanced use cases (e.g. you have 1 RGB only camera and 1 depth only camera)

  • reward_mode – reward mode to use. Must be one of (“normalized_dense”, “dense”, “sparse”, “none”). With “none” the reward returned is always 0

  • control_mode – control mode of the agent. “*” represents all registered controllers, and the action space will be a dict.

  • render_mode – render mode registered in @SUPPORTED_RENDER_MODES.

  • shader_dir (Optional[str]) –

    shader directory. Defaults to None. Setting this will override the shader used for all cameras in the environment. This is legacy behavior kept for backwards compatibility. The proper way to change the shaders used for cameras is to either change the environment code or pass in sensor_configs/human_render_camera_configs with the desired shaders.

    Previously the options are “default”, “rt”, “rt-fast”. “rt” means ray-tracing which results in more photorealistic renders but is slow, “rt-fast” is a lower quality but faster version of “rt”.

  • enable_shadow (bool) – whether to enable shadow for lights. Defaults to False.

  • sensor_configs (dict) – configurations of sensors to override any environment defaults. If the key is one of sensor names (e.g. a camera), the config value will be applied to the corresponding sensor. Otherwise, the value will be applied to all sensors (but overridden by sensor-specific values). For possible configurations see the documentation see the sensors documentation.

  • human_render_camera_configs (dict) – configurations of human rendering cameras to override any environment defaults. Similar usage as @sensor_configs.

  • viewer_camera_configs (dict) – configurations of the viewer camera in the GUI to override any environment defaults. Similar usage as @sensor_configs.

  • robot_uids (Union[str, BaseAgent, list[Union[str, BaseAgent]]]) – list of robots to instantiate and control in the environment.

  • sim_config (Union[SimConfig, dict]) – Configurations for simulation if used that override the environment defaults. If given a dictionary, it can just override specific attributes e.g. sim_config=dict(scene_config=dict(solver_iterations=25)). If passing in a SimConfig object, while typed, will override every attribute including the task defaults. Some environments define their own recommended default sim configurations via the self._default_sim_config attribute that generally should not be completely overriden.

  • reconfiguration_freq (int) – How frequently to call reconfigure when environment is reset via self.reset(…) Generally for most users who are not building tasks this does not need to be changed. The default is 0, which means the environment reconfigures upon creation, and never again.

  • sim_backend (str) – By default this is “auto”. If sim_backend is “auto”, then if num_envs == 1, we use the PhysX CPU sim backend, otherwise we use the PhysX GPU sim backend and automatically pick a GPU to use. Can also be “physx_cpu” or “physx_cuda” to force usage of a particular sim backend. To select a particular GPU to run the simulation on, you can pass “physx_cuda:n” where n is the ID of the GPU, similar to the way PyTorch selects GPUs. Note that if this is “physx_cpu”, num_envs can only be equal to 1.

  • render_backend (str) –

    By default this is “gpu”. If render_backend is “gpu” or it’s alias “sapien_cuda”, then we auto select a GPU to render with. It can be “sapien_cuda:n” where n is the ID of the GPU to render with. If this is “cpu” or “sapien_cpu”, then we try to render on the CPU. If this is “none” or None, then we disable rendering.

    Note that some environments may require rendering functionalities to work. Moreover it is sometimes difficult to determine before running an environment if your machine can render or not. If you encounter some issue with rendering you can first try to double check your NVIDIA drivers / Vulkan drivers are setup correctly. If you don’t need to do rendering you can simply disable it by setting render_backend to “none” or None.

  • parallel_in_single_scene (bool) – By default this is False. If True, rendered images and the GUI will show all objects in one view. This is only really useful for generating cool videos showing all environments at once but it is not recommended otherwise as it slows down simulation and rendering.

  • enhanced_determinism (bool) – By default this is False and env resets will reset the episode RNG only when a seed / seed list is given. If True, the environment will reset the episode RNG upon each reset regardless of whether a seed is provided. Generally enhanced_determinisim is not needed and users are recommended to pass seeds into the env reset function instead.

  • difficulty_level (int) –

_after_reconfigure(options)[source]#

Add code here that should run immediately after self._reconfigure is called. The torch RNG context is still active so RNG is still seeded here by self._episode_seed. This is useful if you need to run something that only happens after reconfiguration but need the GPU initialized so that you can check e.g. collisons, poses etc.

Parameters:

options (dict) –

_get_obs_extra(info)[source]#

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

Parameters:

info (dict) –

_initialize_actors(env_idx)[source]#
Parameters:

env_idx (torch.Tensor) –

_initialize_agent(env_idx)[source]#
Parameters:

env_idx (torch.Tensor) –

_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) –

compute_dense_reward(obs, action, info)[source]#

Compute the dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

evaluate(**kwargs)[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

Return type:

dict

_clearance = 0.003#
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#
agent: mani_skill.agents.robots.AllegroHandRightTouch#
difficulty_level = -1#
hand_init_height = 0.25#
obj_heights: torch.Tensor#
obj_init_pos_noise = 0.02#
robot_init_qpos_noise = 0.02#
class mani_skill.envs.tasks.RotateValveEnv(*args, robot_init_qpos_noise=0.02, valve_init_pos_noise=0.02, difficulty_level=-1, **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Superclass for ManiSkill environments.

Parameters:
  • num_envs – number of parallel environments to run. By default this is 1, which means a CPU simulation is used. If greater than 1, then we initialize the GPU simulation setup. Note that not all environments are faster when simulated on the GPU due to limitations of GPU simulations. For example, environments with many moving objects are better simulated by parallelizing across CPUs.

  • obs_mode – observation mode to be used. Must be one of (“state”, “state_dict”, “none”, “sensor_data”, “rgb”, “depth”, “segmentation”, “rgbd”, “rgb+depth”, “rgb+depth+segmentation”, “rgb+segmentation”, “depth+segmentation”, “pointcloud”) The obs_mode is mostly for convenience to automatically optimize/setup all sensors/cameras for the given observation mode to render the correct data and try to ignore unnecessary rendering. For the most advanced use cases (e.g. you have 1 RGB only camera and 1 depth only camera)

  • reward_mode – reward mode to use. Must be one of (“normalized_dense”, “dense”, “sparse”, “none”). With “none” the reward returned is always 0

  • control_mode – control mode of the agent. “*” represents all registered controllers, and the action space will be a dict.

  • render_mode – render mode registered in @SUPPORTED_RENDER_MODES.

  • shader_dir (Optional[str]) –

    shader directory. Defaults to None. Setting this will override the shader used for all cameras in the environment. This is legacy behavior kept for backwards compatibility. The proper way to change the shaders used for cameras is to either change the environment code or pass in sensor_configs/human_render_camera_configs with the desired shaders.

    Previously the options are “default”, “rt”, “rt-fast”. “rt” means ray-tracing which results in more photorealistic renders but is slow, “rt-fast” is a lower quality but faster version of “rt”.

  • enable_shadow (bool) – whether to enable shadow for lights. Defaults to False.

  • sensor_configs (dict) – configurations of sensors to override any environment defaults. If the key is one of sensor names (e.g. a camera), the config value will be applied to the corresponding sensor. Otherwise, the value will be applied to all sensors (but overridden by sensor-specific values). For possible configurations see the documentation see the sensors documentation.

  • human_render_camera_configs (dict) – configurations of human rendering cameras to override any environment defaults. Similar usage as @sensor_configs.

  • viewer_camera_configs (dict) – configurations of the viewer camera in the GUI to override any environment defaults. Similar usage as @sensor_configs.

  • robot_uids (Union[str, BaseAgent, list[Union[str, BaseAgent]]]) – list of robots to instantiate and control in the environment.

  • sim_config (Union[SimConfig, dict]) – Configurations for simulation if used that override the environment defaults. If given a dictionary, it can just override specific attributes e.g. sim_config=dict(scene_config=dict(solver_iterations=25)). If passing in a SimConfig object, while typed, will override every attribute including the task defaults. Some environments define their own recommended default sim configurations via the self._default_sim_config attribute that generally should not be completely overriden.

  • reconfiguration_freq (int) – How frequently to call reconfigure when environment is reset via self.reset(…) Generally for most users who are not building tasks this does not need to be changed. The default is 0, which means the environment reconfigures upon creation, and never again.

  • sim_backend (str) – By default this is “auto”. If sim_backend is “auto”, then if num_envs == 1, we use the PhysX CPU sim backend, otherwise we use the PhysX GPU sim backend and automatically pick a GPU to use. Can also be “physx_cpu” or “physx_cuda” to force usage of a particular sim backend. To select a particular GPU to run the simulation on, you can pass “physx_cuda:n” where n is the ID of the GPU, similar to the way PyTorch selects GPUs. Note that if this is “physx_cpu”, num_envs can only be equal to 1.

  • render_backend (str) –

    By default this is “gpu”. If render_backend is “gpu” or it’s alias “sapien_cuda”, then we auto select a GPU to render with. It can be “sapien_cuda:n” where n is the ID of the GPU to render with. If this is “cpu” or “sapien_cpu”, then we try to render on the CPU. If this is “none” or None, then we disable rendering.

    Note that some environments may require rendering functionalities to work. Moreover it is sometimes difficult to determine before running an environment if your machine can render or not. If you encounter some issue with rendering you can first try to double check your NVIDIA drivers / Vulkan drivers are setup correctly. If you don’t need to do rendering you can simply disable it by setting render_backend to “none” or None.

  • parallel_in_single_scene (bool) – By default this is False. If True, rendered images and the GUI will show all objects in one view. This is only really useful for generating cool videos showing all environments at once but it is not recommended otherwise as it slows down simulation and rendering.

  • enhanced_determinism (bool) – By default this is False and env resets will reset the episode RNG only when a seed / seed list is given. If True, the environment will reset the episode RNG upon each reset regardless of whether a seed is provided. Generally enhanced_determinisim is not needed and users are recommended to pass seeds into the env reset function instead.

  • difficulty_level (int) –

_get_obs_extra(info)[source]#

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

Parameters:

info (dict) –

_initialize_actors(env_idx)[source]#
Parameters:

env_idx (torch.Tensor) –

_initialize_agent(env_idx)[source]#
Parameters:

env_idx (torch.Tensor) –

_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_articulations()[source]#
_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) –

compute_dense_reward(obs, action, info)[source]#

Compute the dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

evaluate(**kwargs)[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

Return type:

dict

_clearance = 0.003#
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

agent: mani_skill.agents.robots.DClaw#
capsule_offset = 0.01#
difficulty_level = -1#
robot_init_qpos_noise = 0.02#
valve_init_pos_noise = 0.02#
class mani_skill.envs.tasks.SO100GraspCubeEnv(*args, robot_uids='so100', control_mode='pd_joint_target_delta_pos', greenscreen_overlay_path=None, domain_randomization_config=SO100GraspCubeDomainRandomizationConfig(), domain_randomization=True, base_camera_settings=dict(fov=52 * np.pi / 180, pos=[0.5, 0.3, 0.35], target=[0.3, 0.0, 0.1]), spawn_box_pos=[0.3, 0.05], spawn_box_half_size=0.2 / 2, **kwargs)[source]#

Bases: mani_skill.envs.tasks.digital_twins.base_env.BaseDigitalTwinEnv

Task Description: A simple task where the objective is to grasp a cube with the SO100 arm and bring it up to a target rest pose.

Randomizations: - the cube’s xy position is randomized on top of a table in a region of size [0.2, 0.2] x [-0.2, -0.2]. It is placed flat on the table - the cube’s z-axis rotation is randomized to a random angle

Success Conditions: - the cube is lifted, grasped, and the robot returns to a rest pose above the surface of the table

Parameters:

domain_randomization_config (Union[SO100GraspCubeDomainRandomizationConfig, dict]) –

_before_control_step()[source]#

Code that runs before each action has been taken via env.step(action). On GPU simulation this is called before observations are fetched from the GPU buffers.

_get_obs_agent()[source]#

Get observations about the agent’s state. By default it is proprioceptive observations which include qpos and qvel. Controller state is also included although most default controllers do not have any state.

_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_lighting(options)[source]#

Loads lighting into the scene. Called by self._reconfigure. If not overriden will set some simple default lighting

Parameters:

options (dict) –

_load_scene(options)[source]#

Load assets for a digital twin scene in

Parameters:

options (dict) –

compute_dense_reward(obs, action, info)[source]#

Compute the dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

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

sample_camera_poses(n)[source]#
Parameters:

n (int) –

SUPPORTED_OBS_MODES = ['none', 'state', 'state_dict', 'rgb+segmentation']#

The string observation modes the environment supports. Note that “none” and “any_texture” are special keys. none indicates no observation data is generated. “any_texture” indicates that any combination of image textures generated by cameras are supported e.g. rgb+depth, normal+segmentation, albedo+rgb+depth etc. For a full list of supported textures see

SUPPORTED_ROBOTS = ['so100']#

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#
agent: mani_skill.agents.robots.so100.so_100.SO100#
base_camera_settings#

what the camera fov, position and target are when domain randomization is off. DR is centered around these settings

domain_randomization = True#

whether randomization is turned on or off.

domain_randomization_config#

domain randomization config

spawn_box_half_size = 0.1#
spawn_box_pos = [0.3, 0.05]#
class mani_skill.envs.tasks.StackCubeEnv(*args, robot_uids='panda_wristcam', robot_init_qpos_noise=0.02, **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Task Description: The goal is to pick up a red cube and stack it on top of a green cube and let go of the cube without it falling

Randomizations: - both cubes have their z-axis rotation randomized - both cubes have their xy positions on top of the table scene randomized. The positions are sampled such that the cubes do not collide with each other

Success Conditions: - the red cube is on top of the green cube (to within half of the cube size) - the red cube is static - the red cube is not being grasped by the robot (robot must let go of the cube)

_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) –

compute_dense_reward(obs, action, info)[source]#

Compute the dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

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

SUPPORTED_ROBOTS = ['panda_wristcam', 'panda', 'fetch']#

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

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

agent: mani_skill.agents.robots.Panda | mani_skill.agents.robots.Fetch#
robot_init_qpos_noise = 0.02#
class mani_skill.envs.tasks.StackGreenCubeOnYellowCubeBakedTexInScene(**kwargs)[source]#

Bases: mani_skill.envs.tasks.digital_twins.bridge_dataset_eval.base_env.BaseBridgeEnv

Base Digital Twin environment for digital twins of the BridgeData v2

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

get_language_instruction(**kwargs)[source]#
MODEL_JSON = 'info_bridge_custom_baked_tex_v0.json'#
objects_excluded_from_greenscreening = ['baked_green_cube_3cm', 'baked_yellow_cube_3cm']#

object ids that should not be greenscreened

class mani_skill.envs.tasks.StackPyramidEnv(*args, robot_uids='panda_wristcam', robot_init_qpos_noise=0.02, **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Task Description: - The goal is to pick up a red cube, place it next to the green cube, and stack the blue cube on top of the red and green cube without it falling off.

Randomizations: - all cubes have their z-axis rotation randomized - all cubes have their xy positions on top of the table scene randomized. The positions are sampled such that the cubes do not collide with each other

Success Conditions: - the blue cube is static - the blue cube is on top of both the red and green cube (to within half of the cube size) - none of the red, green, blue cubes are grasped by the robot (robot must let go of the cubes)

_sample_video_link = “haosulab/ManiSkill

_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

SUPPORTED_REWARD_MODES = ['none', 'sparse']#
SUPPORTED_ROBOTS = ['panda_wristcam', 'panda', 'fetch']#

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

agent: mani_skill.agents.robots.Panda | mani_skill.agents.robots.Fetch#
robot_init_qpos_noise = 0.02#
class mani_skill.envs.tasks.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#
class mani_skill.envs.tasks.TransportBoxEnv(*args, **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Task Description: A G1 humanoid robot must find a box on a table and transport it to the other table and place it there.

Randomizations: - the box’s xy position is randomized in the region [-0.05, -0.05] x [0.2, 0.05] - the box’s z-axis rotation is randomized to a random angle in [0, np.pi/6]

Success Conditions: - the box is resting on top of the other table

_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) –

compute_dense_reward(obs, action, info)[source]#

Compute the dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

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

SUPPORTED_ROBOTS = ['unitree_g1_simplified_upper_body_with_head_camera']#

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.unitree_g1.g1_upper_body.UnitreeG1UpperBodyWithHeadCamera#
property box_left_grasp_point#
property box_right_grasp_point#
init_robot_pose#
init_robot_qpos#
class mani_skill.envs.tasks.TurnFaucetEnv(*args, robot_uids='panda_wristcam', robot_init_qpos_noise=0.02, reconfiguration_freq=None, num_envs=1, **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Superclass for ManiSkill environments.

Parameters:
  • num_envs – number of parallel environments to run. By default this is 1, which means a CPU simulation is used. If greater than 1, then we initialize the GPU simulation setup. Note that not all environments are faster when simulated on the GPU due to limitations of GPU simulations. For example, environments with many moving objects are better simulated by parallelizing across CPUs.

  • obs_mode – observation mode to be used. Must be one of (“state”, “state_dict”, “none”, “sensor_data”, “rgb”, “depth”, “segmentation”, “rgbd”, “rgb+depth”, “rgb+depth+segmentation”, “rgb+segmentation”, “depth+segmentation”, “pointcloud”) The obs_mode is mostly for convenience to automatically optimize/setup all sensors/cameras for the given observation mode to render the correct data and try to ignore unnecessary rendering. For the most advanced use cases (e.g. you have 1 RGB only camera and 1 depth only camera)

  • reward_mode – reward mode to use. Must be one of (“normalized_dense”, “dense”, “sparse”, “none”). With “none” the reward returned is always 0

  • control_mode – control mode of the agent. “*” represents all registered controllers, and the action space will be a dict.

  • render_mode – render mode registered in @SUPPORTED_RENDER_MODES.

  • shader_dir (Optional[str]) –

    shader directory. Defaults to None. Setting this will override the shader used for all cameras in the environment. This is legacy behavior kept for backwards compatibility. The proper way to change the shaders used for cameras is to either change the environment code or pass in sensor_configs/human_render_camera_configs with the desired shaders.

    Previously the options are “default”, “rt”, “rt-fast”. “rt” means ray-tracing which results in more photorealistic renders but is slow, “rt-fast” is a lower quality but faster version of “rt”.

  • enable_shadow (bool) – whether to enable shadow for lights. Defaults to False.

  • sensor_configs (dict) – configurations of sensors to override any environment defaults. If the key is one of sensor names (e.g. a camera), the config value will be applied to the corresponding sensor. Otherwise, the value will be applied to all sensors (but overridden by sensor-specific values). For possible configurations see the documentation see the sensors documentation.

  • human_render_camera_configs (dict) – configurations of human rendering cameras to override any environment defaults. Similar usage as @sensor_configs.

  • viewer_camera_configs (dict) – configurations of the viewer camera in the GUI to override any environment defaults. Similar usage as @sensor_configs.

  • robot_uids (Union[str, BaseAgent, list[Union[str, BaseAgent]]]) – list of robots to instantiate and control in the environment.

  • sim_config (Union[SimConfig, dict]) – Configurations for simulation if used that override the environment defaults. If given a dictionary, it can just override specific attributes e.g. sim_config=dict(scene_config=dict(solver_iterations=25)). If passing in a SimConfig object, while typed, will override every attribute including the task defaults. Some environments define their own recommended default sim configurations via the self._default_sim_config attribute that generally should not be completely overriden.

  • reconfiguration_freq (int) – How frequently to call reconfigure when environment is reset via self.reset(…) Generally for most users who are not building tasks this does not need to be changed. The default is 0, which means the environment reconfigures upon creation, and never again.

  • sim_backend (str) – By default this is “auto”. If sim_backend is “auto”, then if num_envs == 1, we use the PhysX CPU sim backend, otherwise we use the PhysX GPU sim backend and automatically pick a GPU to use. Can also be “physx_cpu” or “physx_cuda” to force usage of a particular sim backend. To select a particular GPU to run the simulation on, you can pass “physx_cuda:n” where n is the ID of the GPU, similar to the way PyTorch selects GPUs. Note that if this is “physx_cpu”, num_envs can only be equal to 1.

  • render_backend (str) –

    By default this is “gpu”. If render_backend is “gpu” or it’s alias “sapien_cuda”, then we auto select a GPU to render with. It can be “sapien_cuda:n” where n is the ID of the GPU to render with. If this is “cpu” or “sapien_cpu”, then we try to render on the CPU. If this is “none” or None, then we disable rendering.

    Note that some environments may require rendering functionalities to work. Moreover it is sometimes difficult to determine before running an environment if your machine can render or not. If you encounter some issue with rendering you can first try to double check your NVIDIA drivers / Vulkan drivers are setup correctly. If you don’t need to do rendering you can simply disable it by setting render_backend to “none” or None.

  • parallel_in_single_scene (bool) – By default this is False. If True, rendered images and the GUI will show all objects in one view. This is only really useful for generating cool videos showing all environments at once but it is not recommended otherwise as it slows down simulation and rendering.

  • enhanced_determinism (bool) – By default this is False and env resets will reset the episode RNG only when a seed / seed list is given. If True, the environment will reset the episode RNG upon each reset regardless of whether a seed is provided. Generally enhanced_determinisim is not needed and users are recommended to pass seeds into the env reset function instead.

_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

SUPPORTED_REWARD_MODES = ['sparse', 'none']#
SUPPORTED_ROBOTS = ['panda', 'panda_wristcam', 'fetch']#

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

TRAIN_JSON#
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#
agent: mani_skill.agents.robots.Panda | mani_skill.agents.robots.Fetch#
all_model_ids#
property current_angle#
robot_init_qpos_noise = 0.02#
train_info#
class mani_skill.envs.tasks.TwoRobotPickCube(*args, robot_uids=('panda_wristcam', 'panda_wristcam'), robot_init_qpos_noise=0.02, **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Task Description: The goal is to pick up a red cube and lift it to a goal location. There are two robots in this task and the goal location is out of reach of the left robot while the cube is out of reach of the right robot, thus the two robots must work together to move the cube to the goal.

Randomizations: - cube has its z-axis rotation randomized - cube has its xy positions on top of the table scene randomized such that it is in within reach of the left robot but not the right. - the target goal position (marked by a green sphere) of the cube is randomized such that it is within reach of the right robot but not the left.

Success Conditions: - red cube is at the goal location

_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) –

compute_dense_reward(obs, action, info)[source]#

Compute the dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

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

SUPPORTED_ROBOTS = [('panda_wristcam', 'panda_wristcam')]#

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.multi_agent.MultiAgent[Tuple[mani_skill.agents.robots.panda.Panda, mani_skill.agents.robots.panda.Panda]]#
cube_half_size = 0.02#
goal_thresh = 0.025#
property left_agent: mani_skill.agents.robots.panda.Panda#
Return type:

mani_skill.agents.robots.panda.Panda

property right_agent: mani_skill.agents.robots.panda.Panda#
Return type:

mani_skill.agents.robots.panda.Panda

robot_init_qpos_noise = 0.02#
class mani_skill.envs.tasks.TwoRobotStackCube(*args, robot_uids=('panda_wristcam', 'panda_wristcam'), robot_init_qpos_noise=0.02, **kwargs)[source]#

Bases: mani_skill.envs.sapien_env.BaseEnv

Task Description: A collaborative task where two robot arms need to work together to stack two cubes. One robot must pick up the green cube and place it on the target region, while the other robot picks up the blue cube and stacks it on top of the green cube.

The cubes are initially positioned such that each robot can only reach one cube - the green cube is near the right robot and the blue cube is near the left robot. This requires coordination between the robots to complete the stacking task.

Randomizations: - Both cubes have random rotations around their z-axis - The xy positions of both cubes on the table are randomized, while ensuring:

  • The cubes do not collide with each other

  • The green cube remains reachable by the right robot

  • The blue cube remains reachable by the left robot

  • The goal region is placed along the midline between the robots (y=0), with randomized x position

Success Conditions: - The blue cube is stacked on top of the green cube (within half a cube size) - The green cube is placed on the red/white target region - Both cubes are released by the robots (not being grasped)

_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) –

compute_dense_reward(obs, action, info)[source]#

Compute the dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

compute_normalized_dense_reward(obs, action, info)[source]#

Compute the normalized dense reward.

Parameters:
  • obs (Any) – The observation data. By default the observation data will be in its most raw form, a dictionary (no flattening, wrappers etc.)

  • action (torch.Tensor) – The most recent action.

  • info (dict) – The info dictionary.

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

SUPPORTED_ROBOTS = [('panda_wristcam', 'panda_wristcam')]#

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.multi_agent.MultiAgent[Tuple[mani_skill.agents.robots.panda.Panda, mani_skill.agents.robots.panda.Panda]]#
goal_radius = 0.06#
property left_agent: mani_skill.agents.robots.panda.Panda#
Return type:

mani_skill.agents.robots.panda.Panda

property right_agent: mani_skill.agents.robots.panda.Panda#
Return type:

mani_skill.agents.robots.panda.Panda

robot_init_qpos_noise = 0.02#