mani_skill.utils.structs.articulation ===================================== .. py:module:: mani_skill.utils.structs.articulation Classes ------- .. autoapisummary:: mani_skill.utils.structs.articulation.Articulation Module Contents --------------- .. py:class:: Articulation Bases: :py:obj:`mani_skill.utils.structs.BaseStruct`\ [\ :py:obj:`sapien.physx.PhysxArticulation`\ ] Wrapper around physx.PhysxArticulation objects .. py:method:: __hash__() .. py:method:: __repr__() .. py:method:: __str__() .. py:method:: compute_passive_force(*args, **kwargs) .. py:method:: create_from_physx_articulations(physx_articulations, scene, scene_idxs, _merged = False, _process_links = True) :classmethod: 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. .. py:method:: create_pinocchio_model() .. py:method:: find_joint_by_name(arg0) .. py:method:: find_link_by_name(arg0) .. py:method:: get_active_joints() .. py:method:: get_collision_meshes(to_world_frame = True, first_only = False) 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 :param to_world_frame: Whether to transform the collision mesh pose to the world frame :type to_world_frame: bool :param first_only: 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 :type first_only: bool .. py:method:: get_dof() .. py:method:: get_drive_targets() .. py:method:: get_drive_velocities() .. py:method:: get_first_collision_mesh(to_world_frame = True) 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 :param to_world_frame: Whether to transform the collision mesh pose to the world frame :type to_world_frame: bool .. py:method:: get_first_visual_mesh(to_world_frame = True) 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 .. py:method:: get_joint_target_indices(joint_indices) 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. .. py:method:: get_joints() .. py:method:: get_link_incoming_joint_forces() 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] .. py:method:: get_links() .. py:method:: get_name() .. py:method:: get_net_contact_forces(link_names) 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 .. py:method:: get_net_contact_impulses(link_names) 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 .. py:method:: get_pose() .. py:method:: get_qf() .. py:method:: get_qlimits() .. py:method:: get_qpos() .. py:method:: get_qvel() .. py:method:: get_root() .. py:method:: get_root_angular_velocity() .. py:method:: get_root_linear_velocity() .. py:method:: get_root_pose() .. py:method:: get_state() .. py:method:: get_visual_meshes(to_world_frame = True, first_only = False) 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 .. py:method:: merge(articulations, name = None, merge_links = False) :classmethod: Merge a list of articulations into a single articulation for easy access of data across multiple possibly different articulations. :param articulations: A list of articulations objects to merge. :param name: The name of the merged articulation. :param merge_links: 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. .. py:method:: set_joint_drive_targets(targets, joints = None, joint_indices = None) 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. .. py:method:: set_joint_drive_velocity_targets(targets, joints = None, joint_indices = None) 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. .. py:method:: set_pose(arg0) .. py:method:: set_qf(qf) .. py:method:: set_qpos(arg1) .. py:method:: set_qvel(qvel) .. py:method:: set_root_angular_velocity(velocity) .. py:method:: set_root_linear_velocity(velocity) .. py:method:: set_root_pose(pose) .. py:method:: set_state(state, env_idx = None) .. py:attribute:: _cached_joint_target_indices :type: dict[int, torch.Tensor] Map from a set of joints of this articulation and the indexing torch tensor to use for setting drive targets in GPU sims. .. py:property:: _data_index Returns a tensor of the indices of the articulation in the GPU simulation for the physx_cuda backend. .. py:attribute:: _net_contact_force_queries :type: dict[Tuple, sapien.physx.PhysxGpuContactBodyImpulseQuery] Maps a tuple of link names to pre-saved net contact force queries .. py:attribute:: active_joints :type: list[mani_skill.utils.structs.ArticulationJoint] list of active Joint objects, referencing elements in self.joints .. py:attribute:: active_joints_map :type: dict[str, mani_skill.utils.structs.ArticulationJoint] Maps active joint name to the Joint object, referencing elements in self.joints .. py:property:: dof :type: torch.tensor .. py:property:: drive_targets 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. .. py:property:: drive_velocities 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. .. py:property:: fixed_root_link Returns a boolean tensor of whether the root link is fixed for each parallel articulation .. py:attribute:: initial_pose :type: mani_skill.utils.structs.Pose :value: None The initial pose of this articulation .. py:attribute:: joints :type: list[mani_skill.utils.structs.ArticulationJoint] list of Joint objects .. py:attribute:: joints_map :type: dict[str, mani_skill.utils.structs.ArticulationJoint] Maps joint name to the Joint object .. py:attribute:: links :type: list[mani_skill.utils.structs.Link] list of Link objects .. py:attribute:: links_map :type: dict[str, mani_skill.utils.structs.Link] Maps link name to the Link object .. py:property:: max_dof :type: int the max DOF out of all managed objects. This is used to padd attributes like qpos .. py:attribute:: merged :type: bool :value: False 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" .. py:attribute:: name :type: str :value: None Name of this articulation .. py:property:: pose :type: mani_skill.utils.structs.Pose .. py:property:: qacc .. py:property:: qf .. py:property:: qlimits .. py:property:: qpos .. py:property:: qvel .. py:attribute:: root :type: mani_skill.utils.structs.Link The root Link object .. py:property:: root_angular_velocity :type: torch.Tensor .. py:property:: root_linear_velocity :type: torch.Tensor .. py:property:: root_pose