mani_skill.utils.building#

Submodules#

Classes#

ActorBuilder

ActorBuilder class to flexibly build actors in both CPU and GPU simulations.

ArticulationBuilder

MJCFLoader

Wrapper for the SAPIEN MJCF Loader to support easy parallelization

URDFLoader

Functions#

get_articulation_builder(scene, id[, fix_root_link, ...])

Builds an articulation or returns an articulation builder given an ID specifying which dataset/source and then the articulation ID

Package Contents#

class mani_skill.utils.building.ActorBuilder[source]#

Bases: sapien.ActorBuilder

ActorBuilder class to flexibly build actors in both CPU and GPU simulations. This directly inherits the original flexible ActorBuilder from sapien and changes the build functions to support a batch of scenes and return a batch of Actors

add_plane_repeated_visual(pose=sapien.Pose(), half_size=[5, 5], mat=None, texture_repeat=[1, 1])[source]#

Procedurally generateds a repeated 2D texture. Works similarly to https://mujoco.readthedocs.io/en/stable/XMLreference.html#asset-material-texrepeat

currently this always adds a back face

Parameters:
  • texture_repeat (list[float]) – the number of times to repeat the texture in each direction.

  • pose (sapien.Pose) –

  • half_size (list[float]) –

  • mat (sapien.render.RenderMaterial) –

build(name)[source]#

Build the actor with the given name.

Different to the original SAPIEN API, a unique name is required here.

build_dynamic(name)[source]#
build_entity()[source]#

build the raw sapien entity. Modifies original SAPIEN function to accept new procedurally generated render components

build_kinematic(name)[source]#
build_physx_component(link_parent=None)[source]#
build_static(name)[source]#
set_allow_overlapping_plane_collisions(v)[source]#

Set whether or not to permit allowing overlapping plane collisions. In general if you are creating an Actor with a plane collision that is parallelized across multiple sub-scenes, you only need one of those collision shapes. If you add multiple, it will cause the simulation to slow down significantly. By default this is set to False

Parameters:

v (bool) –

set_scene_idxs(scene_idxs=None)[source]#

Set a list of scene indices to build this object in. Cannot be used in conjunction with scene mask

Parameters:

scene_idxs (Optional[Union[list[int], Sequence[int], torch.Tensor, numpy.ndarray]]) –

_allow_overlapping_plane_collisions = False#
_plane_collision_poses#
_procedural_shapes = []#

procedurally generated shapes to attach

initial_pose = None#
scene: mani_skill.envs.scene.ManiSkillScene#
scene_idxs = None#
class mani_skill.utils.building.ArticulationBuilder[source]#

Bases: sapien.wrapper.articulation_builder.ArticulationBuilder

_build_entities(fix_root_link=None, name_prefix='', initial_pose=sapien.Pose())[source]#
build(name=None, fix_root_link=None, build_mimic_joints=True)[source]#
Return type:

mani_skill.utils.structs.Articulation

abstract build_entities(*args, **kwargs)[source]#
Parameters:

parent (sapien.wrapper.articulation_builder.LinkBuilder) –

set_name(name)[source]#
Parameters:

name (str) –

set_scene_idxs(scene_idxs=None)[source]#

Set a list of scene indices to build this object in. Cannot be used in conjunction with scene mask

Parameters:

scene_idxs (Optional[Union[list[int], Sequence[int], torch.Tensor, numpy.ndarray]]) –

disable_self_collisions: bool = False#
initial_pose = None#
name = None#
scene: mani_skill.envs.scene.ManiSkillScene#
scene_idxs = None#
class mani_skill.utils.building.MJCFLoader(ignore_classes=['motor'], visual_groups=[0, 2])[source]#

Bases: mani_skill.utils.building._mjcf_loader.MJCFLoader

Wrapper for the SAPIEN MJCF Loader to support easy parallelization

load(mjcf_file, package_dir=None, name=None, scene_idxs=None)[source]#
Parameters:
  • urdf_file – filename for URDL file

  • srdf_file – SRDF for urdf_file. If srdf_file is None, it defaults to the “.srdf” file with the same as the urdf file

  • package_dir – base directory used to resolve asset files in the URDF file. If an asset path starts with “package://”, “package://” is simply removed from the file name

  • name (str) – name of the created articulation

  • scene_idxs (list[int]) – the ids of the scenes to build the objects in

  • mjcf_file (str) –

Returns:

returns a single Articulation loaded from the URDF file. It throws an error if multiple objects exists

Return type:

mani_skill.utils.structs.Articulation

parse(mjcf_file, package_dir=None)[source]#

Parses a given MJCF file into articulation builders and actor builders and sensor configs

Return type:

ParsedMJCFData

disable_self_collisions: bool = False#
name: str = None#
scene: mani_skill.envs.scene.ManiSkillScene#
class mani_skill.utils.building.URDFLoader[source]#

Bases: sapien.wrapper.urdf_loader.URDFLoader

load(urdf_file, srdf_file=None, package_dir=None, name=None, scene_idxs=None)[source]#
Parameters:
  • urdf_file (str) – filename for URDL file

  • srdf_file – SRDF for urdf_file. If srdf_file is None, it defaults to the “.srdf” file with the same as the urdf file

  • package_dir – base directory used to resolve asset files in the URDF file. If an asset path starts with “package://”, “package://” is simply removed from the file name

  • name (str) – name of the created articulation

  • scene_idxs (list[int]) – the ids of the scenes to build the objects in

Returns:

returns a single Articulation loaded from the URDF file. It throws an error if multiple objects exists

Return type:

mani_skill.utils.structs.articulation.Articulation

load_file_as_articulation_builder(urdf_file, srdf_file=None, package_dir=None)[source]#
Return type:

mani_skill.utils.building.articulation_builder.ArticulationBuilder

parse(urdf_file, srdf_file=None, package_dir=None)[source]#
Return type:

ParsedURDFData

disable_self_collisions: bool = False#
name: str = None#
scene: mani_skill.envs.scene.ManiSkillScene#
mani_skill.utils.building.get_articulation_builder(scene, id, fix_root_link=True, urdf_config=dict())[source]#

Builds an articulation or returns an articulation builder given an ID specifying which dataset/source and then the articulation ID

Currently these IDs are hardcoded for a few datasets. The new Shapedex platform for hosting and managing all assets will be integrated in the future

Parameters:
Return type:

mani_skill.utils.building.articulation_builder.ArticulationBuilder