mani_skill.utils.structs.articulation#

Classes#

Articulation

Wrapper around physx.PhysxArticulation objects

Module Contents#

class mani_skill.utils.structs.articulation.Articulation[source]#

Bases: mani_skill.utils.structs.BaseStruct[sapien.physx.PhysxArticulation]

Wrapper around physx.PhysxArticulation objects

__hash__()[source]#
__repr__()[source]#
__str__()[source]#
compute_passive_force(*args, **kwargs)[source]#
classmethod create_from_physx_articulations(physx_articulations, scene, scene_idxs, _merged=False, _process_links=True)[source]#

Create a managed articulation object given a list of physx articulations. Note that this function requires all given articulations to be the same articulations. To create an object to manage different articulations use the .merge function.

Parameters:
  • physx_articulations (list[sapien.physx.PhysxArticulation]) –

  • scene (mani_skill.envs.scene.ManiSkillScene) –

  • scene_idxs (torch.Tensor) –

  • _merged (bool) –

  • _process_links (bool) –

Return type:

Articulation

create_pinocchio_model()[source]#
find_joint_by_name(arg0)[source]#
Parameters:

arg0 (str) –

Return type:

mani_skill.utils.structs.ArticulationJoint

Parameters:

arg0 (str) –

Return type:

mani_skill.utils.structs.Link

get_active_joints()[source]#
get_collision_meshes(to_world_frame=True, first_only=False)[source]#

Returns the collision mesh of each managed articulation object. Note results of this are not cached or optimized at the moment so this function can be slow if called too often

Parameters:
  • to_world_frame (bool) – Whether to transform the collision mesh pose to the world frame

  • first_only (bool) – Whether to return the collision mesh of just the first articulation managed by this object. If True, this also returns a single Trimesh.Mesh object instead of a list. This can be useful for efficiency reasons if you know ahead of time all of the managed actors have the same collision mesh

Return type:

Union[list[trimesh.Trimesh], trimesh.Trimesh]

get_dof()[source]#
Return type:

int

get_drive_targets()[source]#
get_drive_velocities()[source]#
get_first_collision_mesh(to_world_frame=True)[source]#

Returns the collision mesh of the first managed articulation object. Note results of this are not cached or optimized at the moment so this function can be slow if called too often. Some articulations have no collision meshes, in which case this function returns None

Parameters:

to_world_frame (bool) – Whether to transform the collision mesh pose to the world frame

Return type:

Union[trimesh.Trimesh, None]

get_first_visual_mesh(to_world_frame=True)[source]#

Returns the visual mesh of the first managed articulation object. Note results of this are not cached or optimized at the moment so this function can be slow if called too often

Parameters:

to_world_frame (bool) –

Return type:

trimesh.Trimesh

get_joint_target_indices(joint_indices)[source]#

Gets the meshgrid indexes for indexing px.cuda_articulation_target_* values given a 1D list of joint indexes or a 1D list of ArticulationJoint objects.

Internally the given input is made to a tuple for a cache key and is used to cache results for fast lookup in the future, particularly for large-scale GPU simulations.

Parameters:

joint_indices (Union[mani_skill.utils.structs.types.Array, list[int], list[mani_skill.utils.structs.ArticulationJoint]]) –

get_joints()[source]#

Returns the incoming joint forces, referred to as spatial forces, for each link, with shape (N, M, 6), where N is the number of environments and M is the number of links.

Spatial forces are complex to describe and we recommend you see the physx documentation for how they are computed: https://nvidia-omniverse.github.io/PhysX/physx/5.6.0/docs/Articulations.html#link-incoming-joint-force

The mth spatial force refers to the mth link, and to find a particular link you can find the Link object first then use it’s index attribute.

link = articulation.links_map[link_name] link_index = link.index link_incoming_joint_force = articulation.get_link_incoming_joint_forces()[:, link_index]

get_name()[source]#
Return type:

str

get_net_contact_forces(link_names)[source]#

Get net contact forces for several links together. This should be faster compared to using link.get_net_contact_forces on each link.

Returns force vector of shape (N, len(link_names), 3) where N is the number of environments

Parameters:

link_names (Union[list[str], Tuple[str]]) –

get_net_contact_impulses(link_names)[source]#

Get net contact impulses for several links together. This should be faster compared to using link.get_net_contact_impulses on each link.

Returns impulse vector of shape (N, len(link_names), 3) where N is the number of environments

Parameters:

link_names (Union[list[str], Tuple[str]]) –

get_pose()[source]#
Return type:

sapien.Pose

get_qf()[source]#
get_qlimits()[source]#
get_qpos()[source]#
get_qvel()[source]#
get_root()[source]#
get_root_angular_velocity()[source]#
Return type:

torch.Tensor

get_root_linear_velocity()[source]#
Return type:

torch.Tensor

get_root_pose()[source]#
get_state()[source]#
get_visual_meshes(to_world_frame=True, first_only=False)[source]#

Returns the visual mesh of each managed articulation object. Note results of this are not cached or optimized at the moment so this function can be slow if called too often

Parameters:
  • to_world_frame (bool) –

  • first_only (bool) –

Return type:

list[trimesh.Trimesh]

classmethod merge(articulations, name=None, merge_links=False)[source]#

Merge a list of articulations into a single articulation for easy access of data across multiple possibly different articulations.

Parameters:
  • articulations (list[Articulation]) – A list of articulations objects to merge.

  • name (str) – The name of the merged articulation.

  • merge_links (bool) – Whether to merge the links of the articulations. This is by default False as often times you merge articulations that have different number of links. Set this true if you want to try and merge articulations that have the same number of links.

set_joint_drive_targets(targets, joints=None, joint_indices=None)[source]#

Set drive targets on active joints given joints. For GPU simulation only joint_indices argument is supported, which should be a 1D list of the active joint indices in the articulation.

joints argument will always be used when possible and is the recommended approach. On CPU simulation the joints argument is required, joint_indices is not supported.

Parameters:
set_joint_drive_velocity_targets(targets, joints=None, joint_indices=None)[source]#

Set drive velocity targets on active joints given joints. For GPU simulation only joint_indices argument is supported, which should be a 1D list of the active joint indices in the articulation.

joints argument will always be used when possible and is the recommended approach. On CPU simulation the joints argument is required, joint_indices is not supported.

Parameters:
set_pose(arg0)[source]#
Parameters:

arg0 (sapien.Pose) –

Return type:

None

set_qf(qf)[source]#
Parameters:

qf (mani_skill.utils.structs.types.Array) –

Return type:

None

set_qpos(arg1)[source]#
Parameters:

arg1 (mani_skill.utils.structs.types.Array) –

set_qvel(qvel)[source]#
Parameters:

qvel (mani_skill.utils.structs.types.Array) –

Return type:

None

set_root_angular_velocity(velocity)[source]#
Parameters:

velocity (mani_skill.utils.structs.types.Array) –

Return type:

None

set_root_linear_velocity(velocity)[source]#
Parameters:

velocity (mani_skill.utils.structs.types.Array) –

Return type:

None

set_root_pose(pose)[source]#
Parameters:

pose (sapien.Pose) –

Return type:

None

set_state(state, env_idx=None)[source]#
Parameters:
  • state (mani_skill.utils.structs.types.Array) –

  • env_idx (torch.Tensor) –

_cached_joint_target_indices: dict[int, torch.Tensor][source]#

Map from a set of joints of this articulation and the indexing torch tensor to use for setting drive targets in GPU sims.

property _data_index[source]#

Returns a tensor of the indices of the articulation in the GPU simulation for the physx_cuda backend.

_net_contact_force_queries: dict[Tuple, sapien.physx.PhysxGpuContactBodyImpulseQuery][source]#

Maps a tuple of link names to pre-saved net contact force queries

active_joints: list[mani_skill.utils.structs.ArticulationJoint][source]#

list of active Joint objects, referencing elements in self.joints

active_joints_map: dict[str, mani_skill.utils.structs.ArticulationJoint][source]#

Maps active joint name to the Joint object, referencing elements in self.joints

property dof: torch.tensor[source]#
Return type:

torch.tensor

property drive_targets[source]#

The current drive targets of the active joints. Also known as the target joint positions. Returns a tensor of shape (N, M) where N is the number of environments and M is the number of active joints.

property drive_velocities[source]#

The current drive velocity targets of the active joints. Also known as the target joint velocities. Returns a tensor of shape (N, M) where N is the number of environments and M is the number of active joints.

Returns a boolean tensor of whether the root link is fixed for each parallel articulation

initial_pose: mani_skill.utils.structs.Pose = None[source]#

The initial pose of this articulation

joints: list[mani_skill.utils.structs.ArticulationJoint][source]#

list of Joint objects

joints_map: dict[str, mani_skill.utils.structs.ArticulationJoint][source]#

Maps joint name to the Joint object

list of Link objects

Maps link name to the Link object

property max_dof: int[source]#

the max DOF out of all managed objects. This is used to padd attributes like qpos

Return type:

int

merged: bool = False[source]#

whether or not this articulation object is a merged articulation where it is managing many articulations with different dofs.

There are a number of caveats when it comes to merged articulations. While merging articulations means you can easily fetch padded qpos, qvel, etc. type data, a number of attributes and functions will make little sense and you should avoid using them unless you are an advanced user. In particular, the list of Links, Joints, their corresponding maps, net contact forces of multiple links, no longer make “sense”

name: str = None[source]#

Name of this articulation

property pose: mani_skill.utils.structs.Pose[source]#
Return type:

mani_skill.utils.structs.Pose

property qacc[source]#
property qf[source]#
property qlimits[source]#
property qpos[source]#
property qvel[source]#
root: mani_skill.utils.structs.Link[source]#

The root Link object

property root_angular_velocity: torch.Tensor[source]#
Return type:

torch.Tensor

property root_linear_velocity: torch.Tensor[source]#
Return type:

torch.Tensor

property root_pose[source]#