mani_skill.sensors module#

class mani_skill.sensors.base_sensor.BaseSensor(config: BaseSensorConfig)[source]#

Base class for all sensors

capture() None[source]#

Captures sensor data and prepares it for it to be then retrieved via get_obs for observations and get_image for a visualizable image.

Some sensors like rgbd cameras need to take a picture just once after each call to scene.update_render. Generally this should also be a non-blocking function if possible.

get_images() Tensor[source]#

This returns the data of the sensor visualized as an image (rgb array of shape (B, H, W, 3)). This should not be used for generating agent observations. For example lidar data can be visualized as an image but should not be in a image format (H, W, 3) when being used by an agent.

get_obs(**kwargs)[source]#

Retrieves captured sensor data as an observation for use by an agent.

get_params() Dict[source]#

Get parameters for this sensor. Should return a dictionary with keys mapping to torch.Tensor values

setup() None[source]#

Setup this sensor given the current scene. This is called during environment/scene reconfiguration.

property uid#
class mani_skill.sensors.base_sensor.BaseSensorConfig(uid: str)[source]#
uid: str#
class mani_skill.sensors.camera.Camera(camera_config: CameraConfig, scene: ManiSkillScene, articulation: Articulation = None)[source]#

Implementation of the Camera sensor which uses the sapien Camera.

capture()[source]#

Captures sensor data and prepares it for it to be then retrieved via get_obs for observations and get_image for a visualizable image.

Some sensors like rgbd cameras need to take a picture just once after each call to scene.update_render. Generally this should also be a non-blocking function if possible.

config: CameraConfig#
get_images(obs) Tensor[source]#

This returns the data of the sensor visualized as an image (rgb array of shape (B, H, W, 3)). This should not be used for generating agent observations. For example lidar data can be visualized as an image but should not be in a image format (H, W, 3) when being used by an agent.

get_obs(rgb: bool = True, depth: bool = True, position: bool = True, segmentation: bool = True, normal: bool = False, albedo: bool = False, apply_texture_transforms: bool = True)[source]#

Retrieves captured sensor data as an observation for use by an agent.

get_params()[source]#

Get parameters for this sensor. Should return a dictionary with keys mapping to torch.Tensor values

class mani_skill.sensors.camera.CameraConfig(uid: 'str', pose: 'Pose', width: 'int', height: 'int', fov: 'float' = None, near: 'float' = 0.01, far: 'float' = 100, intrinsic: 'Array' = None, entity_uid: 'Optional[str]' = None, mount: 'Union[Actor, Link]' = None, shader_pack: 'Optional[str]' = 'minimal', shader_config: 'Optional[ShaderConfig]' = None)[source]#
entity_uid: str | None = None#

unique id of the entity to mount the camera. Defaults to None. Only used by agent classes that want to define mounted cameras.

far: float = 100#

far plane of the camera

fov: float = None#

The field of view of the camera. Either fov or intrinsic must be given

height: int#

height of the camera

intrinsic: Tensor | ndarray | Sequence = None#

intrinsics matrix of the camera. Either fov or intrinsic must be given

mount: Actor | Link = None#

the Actor or Link to mount the camera on top of. This means the global pose of the mounted camera is now mount.pose * local_pose

near: float = 0.01#

near plane of the camera

pose: Pose#

Pose of the camera

shader_config: ShaderConfig | None = None#

The shader config to use for rendering. If None, the shader_pack will be used to search amongst prebuilt shader configs to create a ShaderConfig.

shader_pack: str | None = 'minimal'#

The shader to use for rendering. Defaults to “minimal” which is the fastest rendering system with minimal GPU memory usage. There is also default and rt.

uid: str#

unique id of the camera

Type:

uid (str)

width: int#

width of the camera

mani_skill.sensors.camera.camera_observations_to_images(observations: Dict[str, Tensor], max_depth=None) List[Tensor | ndarray | Sequence][source]#

Parse images from camera observations.

mani_skill.sensors.camera.normalize_depth(depth, min_depth=0, max_depth=None)[source]#
mani_skill.sensors.camera.parse_camera_configs(camera_configs)[source]#
mani_skill.sensors.camera.update_camera_configs_from_dict(camera_configs: Dict[str, CameraConfig], config_dict: Dict[str, dict])[source]#