mani_skill.utils.building.articulations ======================================= .. py:module:: mani_skill.utils.building.articulations Submodules ---------- .. toctree:: :maxdepth: 1 /api/mani_skill/utils/building/articulations/partnet_mobility/index /api/mani_skill/utils/building/articulations/robel/index Classes ------- .. autoapisummary:: mani_skill.utils.building.articulations.ArticulationBuilder mani_skill.utils.building.articulations.ManiSkillScene Functions --------- .. autoapisummary:: mani_skill.utils.building.articulations.build_robel_valve mani_skill.utils.building.articulations.get_articulation_builder Package Contents ---------------- .. py:class:: ArticulationBuilder Bases: :py:obj:`sapien.wrapper.articulation_builder.ArticulationBuilder` .. py:method:: _build_entities(fix_root_link=None, name_prefix='', initial_pose=sapien.Pose()) .. py:method:: build(name=None, fix_root_link=None, build_mimic_joints=True) .. py:method:: build_entities(*args, **kwargs) :abstractmethod: .. py:method:: create_link_builder(parent = None) .. py:method:: set_name(name) .. py:method:: set_scene_idxs(scene_idxs = None) Set a list of scene indices to build this object in. Cannot be used in conjunction with scene mask .. py:attribute:: disable_self_collisions :type: bool :value: False .. py:attribute:: initial_pose :value: None .. py:attribute:: name :value: None .. py:attribute:: scene :type: mani_skill.envs.scene.ManiSkillScene .. py:attribute:: scene_idxs :value: None .. py:class:: ManiSkillScene(sub_scenes = None, sim_config = SimConfig(), debug_mode = True, device = None, parallel_in_single_scene = False, backend = None) Class that manages a list of sub-scenes (sapien.Scene). In CPU simulation there should only be one sub-scene. In GPU simulation, there can be many sub-scenes, and this wrapper ensures that use calls to many of the original sapien.Scene API are applied to all sub-scenes. This includes calls to change object poses, velocities, drive targets etc. This wrapper also helps manage GPU states if GPU simulation is used .. py:method:: _get_all_render_bodies() .. py:method:: _gpu_apply_all() Calls gpu_apply to update all body data, qpos, qvel, qf, and root poses .. py:method:: _gpu_fetch_all() Queries simulation for all relevant GPU data. Note that this has some overhead. Should only be called at most once per simulation step as this automatically queries all data for all objects built in the scene. .. py:method:: _gpu_setup_sensors(sensors) .. py:method:: _sapien_31_add_camera(name, pose, width, height, near, far, fovy = None, intrinsic = None, mount = None) internal helper function to add (mounted) cameras .. py:method:: _sapien_31_gpu_setup_sensors(sensors) .. py:method:: _sapien_31_setup_gpu_rendering() Prepares the scene for GPU parallelized rendering to enable taking e.g. RGB images .. py:method:: _sapien_31_update_render(update_sensors = True, update_human_render_cameras = True) .. py:method:: _sapien_add_camera(name, pose, width, height, near, far, fovy = None, intrinsic = None, mount = None) internal helper function to add (mounted) cameras .. py:method:: _sapien_gpu_setup_sensors(sensors) .. py:method:: _sapien_setup_gpu_rendering() Prepares the scene for GPU parallelized rendering to enable taking e.g. RGB images .. py:method:: _sapien_update_render(update_sensors = True, update_human_render_cameras = True) .. py:method:: _setup(enable_gpu) Start the CPU/GPU simulation and allocate all buffers and initialize objects .. py:method:: _setup_gpu_rendering() .. py:method:: add_area_light_for_ray_tracing(pose, color, half_width, half_height, scene_idxs=None) .. py:method:: add_camera(name, pose, width, height, near, far, fovy = None, intrinsic = None, mount = None) Add's a (mounted) camera to the scene .. py:method:: add_directional_light(direction, color, shadow=False, position=[0, 0, 0], shadow_scale=10.0, shadow_near=-10.0, shadow_far=10.0, shadow_map_size=2048, scene_idxs = None) .. py:method:: add_point_light(position, color, shadow=False, shadow_near=0.1, shadow_far=10.0, shadow_map_size=2048, scene_idxs = None) .. py:method:: add_spot_light(position, direction, inner_fov, outer_fov, color, shadow=False, shadow_near=0.1, shadow_far=10.0, shadow_map_size=2048, scene_idxs = None) .. py:method:: add_to_state_dict_registry(object) .. py:method:: can_render() Whether or not this Scene object permits rendering, depending on the rendering device selected .. py:method:: create_actor_builder() Creates an ActorBuilder object that can be used to build actors in this scene .. py:method:: create_articulation_builder() Creates an ArticulationBuilder object that can be used to build articulations in this scene .. py:method:: create_drive(body0, pose0, body1, pose1) .. py:method:: create_mjcf_loader() Creates a MJCFLoader object that can be used to load MJCF files into this scene .. py:method:: create_urdf_loader() Creates a URDFLoader object that can be used to load URDF files into this scene .. py:method:: get_all_actors() Returns list of all sapien.Entity objects that have rigid dynamic and static components across all sub scenes .. py:method:: get_all_articulations() Returns list of all physx articulation objects across all sub scenes .. py:method:: get_contacts() .. py:method:: get_human_render_camera_images(camera_name = None) .. py:method:: get_pairwise_contact_forces(obj1, obj2) Get the force vectors between two actors/links. Returns force vector of shape (N, 3) where N is the number of environments and 3 is the dimension of the force vector itself, representing x, y, and z direction of force. :param obj1: Actor | Link :param obj2: Actor | Link .. py:method:: get_pairwise_contact_impulses(obj1, obj2) Get the impulse vectors between two actors/links. Returns impulse vector of shape (N, 3) where N is the number of environments and 3 is the dimension of the impulse vector itself, representing x, y, and z direction of impulse. Note that dividing the impulse value by self.px.timestep yields the pairwise contact force in Newtons. The equivalent API for that is self.get_pairwise_contact_force(obj1, obj2). It is generally recommended to use the force values since they are independent of the timestep (dt = 1 / sim_freq) of the simulation. :param obj1: Actor | Link :param obj2: Actor | Link .. py:method:: get_sensor_images(obs) Get raw sensor data as images for visualization purposes. .. py:method:: get_sim_state() Get simulation state. Returns a dictionary with two nested dictionaries "actors" and "articulations". In the nested dictionaries they map the actor/articulation name to a vector of shape (N, D) for N parallel environments and D dimensions of padded state per environment. Note that static actor data are not included. It is expected that an environment reconstructs itself in a deterministic manner such that the same static actors always have the same states .. py:method:: get_timestep() Returns the current simulation timestep .. py:method:: remove_actor(actor) Removes an actor from the scene. Only works in CPU simulation. .. py:method:: remove_articulation(articulation) Removes an articulation from the scene. Only works in CPU simulation. .. py:method:: remove_from_state_dict_registry(object) .. py:method:: set_ambient_light(color) .. py:method:: set_sim_state(state, env_idx = None) .. py:method:: set_timestep(timestep) Sets the current simulation timestep .. py:method:: step() .. py:method:: update_render(update_sensors = True, update_human_render_cameras = True) Updates the renderer based on the current simulation state. Note that on the first call if a sensor/human render camera is required to be updated, GPU memory will be allocated for the sensor/human render camera respectively. :param update_sensors: Whether to update the sensors. :type update_sensors: bool :param update_human_render_cameras: Whether to update the human render cameras. :type update_human_render_cameras: bool .. py:attribute:: _gpu_sim_initialized :value: False .. py:attribute:: _human_render_cameras_initialized :value: False .. py:attribute:: _needs_fetch :value: False Used internally to raise some errors ahead of time of when there may be undefined behaviors .. py:attribute:: _pairwise_contact_query_unique_hashes :type: dict[str, int] maps keys in self.pairwise_contact_queries to unique hashes dependent on the actual objects involved in the query. This is used to determine automatically when to rebuild contact queries as keys for self.pairwise_contact_queries are kept non-unique between episode resets in order to be easily rebuilt and deallocate old queries. This essentially acts as a way to invalidate the cached queries. .. py:attribute:: _reset_mask Used internally by various objects like Actor, Link, and Controllers to auto mask out sub-scenes so they do not get modified during partial env resets .. py:attribute:: _sensors_initialized :value: False .. py:attribute:: actor_views :type: dict[str, mani_skill.utils.structs.actor.Actor] views of actors in any sub-scenes created by using Actor.merge and queryable as if it were a single Actor .. py:attribute:: actors :type: dict[str, mani_skill.utils.structs.actor.Actor] .. py:property:: ambient_light .. py:attribute:: articulation_views :type: dict[str, mani_skill.utils.structs.articulation.Articulation] views of articulations in any sub-scenes created by using Articulation.merge and queryable as if it were a single Articulation .. py:attribute:: articulations :type: dict[str, mani_skill.utils.structs.articulation.Articulation] .. py:attribute:: backend :value: None .. py:attribute:: camera_groups :type: dict[str, sapien.render.RenderCameraGroup] .. py:attribute:: debug_mode :value: True .. py:attribute:: device :value: None .. py:attribute:: gpu_sim_enabled :value: True whether the sub scenes are using the GPU or CPU backend .. py:attribute:: human_render_cameras :type: dict[str, mani_skill.sensors.camera.Camera] .. py:property:: num_envs .. py:attribute:: pairwise_contact_queries :type: dict[str, sapien.physx.PhysxGpuContactPairImpulseQuery] dictionary mapping pairwise contact query keys to GPU contact queries. Used in GPU simulation only to cache queries as query creation will pause any GPU sim computation .. py:attribute:: parallel_in_single_scene :type: bool :value: False Whether rendering all parallel scenes in the viewer/gui is enabled .. py:attribute:: px :type: Union[sapien.physx.PhysxCpuSystem, sapien.physx.PhysxGpuSystem] .. py:attribute:: render_system_group :type: sapien.render.RenderSystemGroup :value: None .. py:property:: scene_offsets torch tensor of shape (num_envs, 3) representing the offset of each scene in the world frame .. py:property:: scene_offsets_np numpy array of shape (num_envs, 3) representing the offset of each scene in the world frame .. py:attribute:: sensors :type: dict[str, mani_skill.sensors.base_sensor.BaseSensor] .. py:attribute:: sim_config .. py:attribute:: state_dict_registry :type: StateDictRegistry state dict registry that map actor/articulation names to Actor/Articulation struct references. Only these structs are used for the environment state .. py:attribute:: sub_scenes :value: None .. py:property:: timestep The current simulation timestep .. py:function:: build_robel_valve(scene, valve_angles, name, radius_scale = 1.0, capsule_radius_scale = 1.0, scene_idxs=None) .. py:function:: get_articulation_builder(scene, id, fix_root_link = True, urdf_config = dict()) 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