mani_skill.utils.sapien_utils ============================= .. py:module:: mani_skill.utils.sapien_utils .. autoapi-nested-parse:: Utilities that work with the simulation / SAPIEN Attributes ---------- .. autoapisummary:: mani_skill.utils.sapien_utils.T Functions --------- .. autoapisummary:: mani_skill.utils.sapien_utils.apply_urdf_config mani_skill.utils.sapien_utils.check_actor_static mani_skill.utils.sapien_utils.check_joint_stuck mani_skill.utils.sapien_utils.check_urdf_config mani_skill.utils.sapien_utils.compute_total_impulse mani_skill.utils.sapien_utils.create_viewer mani_skill.utils.sapien_utils.get_actor_state mani_skill.utils.sapien_utils.get_articulation_padded_state mani_skill.utils.sapien_utils.get_articulation_state mani_skill.utils.sapien_utils.get_cpu_actor_contacts mani_skill.utils.sapien_utils.get_cpu_actors_contacts mani_skill.utils.sapien_utils.get_multiple_pairwise_contacts mani_skill.utils.sapien_utils.get_obj_by_name mani_skill.utils.sapien_utils.get_obj_by_type mani_skill.utils.sapien_utils.get_objs_by_names mani_skill.utils.sapien_utils.get_pairwise_contact_impulse mani_skill.utils.sapien_utils.get_pairwise_contacts mani_skill.utils.sapien_utils.hex2rgba mani_skill.utils.sapien_utils.is_state_dict_consistent mani_skill.utils.sapien_utils.look_at mani_skill.utils.sapien_utils.parse_urdf_config mani_skill.utils.sapien_utils.sapien_pose_to_opencv_extrinsic mani_skill.utils.sapien_utils.set_articulation_render_material mani_skill.utils.sapien_utils.set_render_material Module Contents --------------- .. py:function:: apply_urdf_config(loader, urdf_config) .. py:function:: check_actor_static(actor, lin_thresh=0.001, ang_thresh=0.01) .. py:function:: check_joint_stuck(articulation, active_joint_idx, pos_diff_threshold = 0.001, vel_threshold = 0.0001) .. py:function:: check_urdf_config(urdf_config) Check whether the urdf config is valid for SAPIEN. :param urdf_config: dict passed to `sapien.URDFLoader.load`. :type urdf_config: dict .. py:function:: compute_total_impulse(contact_infos) .. py:function:: create_viewer(viewer_camera_config) Creates a viewer with the given camera config .. py:function:: get_actor_state(actor) .. py:function:: get_articulation_padded_state(articulation, max_dof) .. py:function:: get_articulation_state(articulation) .. py:function:: get_cpu_actor_contacts(contacts, actor) .. py:function:: get_cpu_actors_contacts(contacts, actors) This function is used to avoid double for-loop when using `get_actor_contacts` with multiple actors .. py:function:: get_multiple_pairwise_contacts(contacts, actor0, actor1_list) Given a list of contacts, return the dict of contacts involving the one actor and actors This function is used to avoid double for-loop when using `get_pairwise_contacts` with multiple actors .. py:function:: get_obj_by_name(objs, name, is_unique=True) Get a object given the name. :param objs: objs to query. Expect these objects to have a get_name function. These may be sapien.Entity, physx.PhysxArticulationLink etc. :type objs: list[T] :param name: name for query. :type name: str :param is_unique: whether the name should be unique. Defaults to True. :type is_unique: bool, optional :raises RuntimeError: The name is not unique when @is_unique is True. :returns: matched T or Ts. None if no matches. :rtype: T or list[T] .. py:function:: get_obj_by_type(objs, target_type, is_unique=True) .. py:function:: get_objs_by_names(objs, names) Get a list of objects given a list of names from a larger list of objects (objs). The returned list is in the order of the names given :param objs: objs to query. Expect these objects to have a get_name function. These may be sapien.Entity, physx.PhysxArticulationLink etc. :type objs: list[T] :param name: names to query. :type name: str :returns: matched T or Ts. None if no matches. :rtype: T or list[T] .. py:function:: get_pairwise_contact_impulse(contacts, actor0, actor1) .. py:function:: get_pairwise_contacts(contacts, actor0, actor1) Given a list of contacts, return the list of contacts involving the two actors .. py:function:: hex2rgba(h, correction=True) .. py:function:: is_state_dict_consistent(state_dict) Checks if the given state dictionary (generated via env.get_state_dict()) is consistent where each actor/articulation has the same batch dimension .. py:function:: look_at(eye, target, up=(0, 0, 1), device=None) Get the camera pose in SAPIEN by the Look-At method. .. note:: https://www.scratchapixel.com/lessons/mathematics-physics-for-computer-graphics/lookat-function The SAPIEN camera follows the convention: (forward, right, up) = (x, -y, z) while the OpenGL camera follows (forward, right, up) = (-z, x, y) Note that the camera coordinate system (OpenGL) is left-hand. :param eye: camera location :param target: looking-at location :param up: a general direction of "up" from the camera. :param device: device to put the pose on. :returns: camera pose :rtype: Pose .. py:function:: parse_urdf_config(config_dict) Parse config from dict for SAPIEN URDF loader. :param config_dict: a dict containing link physical properties. :type config_dict: dict :returns: urdf config passed to `sapien.URDFLoader.load`. :rtype: dict .. py:function:: sapien_pose_to_opencv_extrinsic(sapien_pose_matrix) .. py:function:: set_articulation_render_material(articulation, **kwargs) .. py:function:: set_render_material(material, **kwargs) .. py:data:: T