Simulate documentation

Sensors

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v0.1.2).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

Sensors

Three types of Sensor are provided in Simulate:

  • Camera sensors - for RGB observations
  • State sensors - For measurements of positions & rotations
  • Raycast sensors - for depth measurements.

class simulate.Camera

< >

( width: int = 256 height: int = 256 camera_type: str = 'perspective' znear: float = 0.3 yfov: typing.Union[float, numpy.ndarray, NoneType] = 60 aspect_ratio: typing.Optional[float] = None zfar: typing.Optional[float] = None xmag: typing.Optional[float] = None ymag: typing.Optional[float] = None name: typing.Optional[str] = None sensor_tag: str = 'CameraSensor' position: typing.Optional[typing.List[float]] = None rotation: typing.Optional[typing.List[float]] = None scaling: typing.Union[float, typing.List[float], NoneType] = None is_actor: bool = False parent: typing.Optional[ForwardRef('Asset')] = None children: typing.Optional[typing.List[ForwardRef('Asset')]] = None )

Parameters

  • width (int, optional, defaults to 256) — The width of the Camera. Default: 256
  • height (int, optional, defaults to 256) — The height of the Camera. Default: 256
  • camera_type (str, optional, defaults to perspective) — The type of camera. Can be one of: [ “perspective”, “orthographic” ]
  • znear (float, optional, defaults to 0.3) — The near clipping plane of the Camera.
  • yfov (float or np.ndarray, optional, defaults to 60) — The vertical field of view of the Camera in degrees.
  • aspect_ratio (float, optional, defaults to None) — The aspect ratio of the Camera if needed
  • zfar (float, optional, defaults to None) — The far clipping plane of the Camera.
  • xmag (float, optional, defaults to None) — The x magnification of the Camera.
  • ymag (float, optional, defaults to None) — The y magnification of the Camera.
  • name (str, optional, defaults to None) — The name of the Camera.
  • sensor_tag (str, optional, defaults to CameraSensor) — The tag of the Camera.
  • position (List[float], optional, defaults to [0.0, 0.0, 0.0]) — The position of the Camera.
  • rotation (List[float], optional, defaults to [0.0, 0.0, 0.0]) — The rotation of the Camera.
  • scaling (float or List[float], optional, defaults to 1.0) — The scaling of the Camera.
  • is_actor (bool, optional, defaults to False) — Whether the Camera is an actor.
  • parent (Asset, optional, defaults to None) — The parent of the Camera.
  • children (List[Asset], optional, defaults to None) — The children of the Camera.

A Camera asset. This Camera is located at the origin by default and has no rotation.

copy

< >

( with_children: bool = True **kwargs: typing.Any )

Parameters

  • with_children (bool, optional, defaults to True) — Whether to copy the children of the Camera.

Make a copy of the Camera with copy of the children attached to the copy.

class simulate.StateSensor

< >

( target_entity: typing.Optional[typing.Any] = None reference_entity: typing.Optional[typing.Any] = None properties: typing.Union[str, typing.List[str], NoneType] = None sensor_tag: str = 'StateSensor' name: dataclasses.InitVar[typing.Optional[str]] = None position: dataclasses.InitVar[typing.Optional[typing.List[float]]] = <property object at 0x7f9e74ddcef0> rotation: dataclasses.InitVar[typing.Optional[typing.List[float]]] = <property object at 0x7f9e74ddcd60> scaling: dataclasses.InitVar[typing.Union[float, typing.List[float], NoneType]] = <property object at 0x7f9e74ddcdb0> transformation_matrix: dataclasses.InitVar[typing.Optional[typing.List[float]]] = <property object at 0x7f9e74ddce00> parent: dataclasses.InitVar[typing.Optional[ForwardRef('Asset')]] = None children: dataclasses.InitVar[typing.Optional[typing.List[ForwardRef('Asset')]]] = None created_from_file: dataclasses.InitVar[typing.Optional[str]] = None )

Parameters

  • target_entity (Asset or str, optional, defaults to None) — Reference or name of the target Asset in the scene.
  • reference_entity (Asset or str, optional, defaults to None) — Reference or name of the reference Asset in the scene. If no reference is provided we use the world as a reference.
  • properties (str or List[str], optional, defaults to ["distance"]) — List of properties to extract from the sensor. Allowed properties are: [ “position”, “position.x”, “position.y”, “position.z”, “velocity”, “velocity.x”, “velocity.y”, “velocity.z”, “rotation”, “rotation.x”, “rotation.y”, “rotation.z”, “angular_velocity”, “angular_velocity.x”, “angular_velocity.y”, “angular_velocity.z”, “distance” ]
  • sensor_tag (str, optional, defaults to "StateSensor") — Type of sensor. Allowed values are: “position”, “velocity”, “rotation”, “angular_velocity”, “distance”.
  • name (str, optional, defaults to None) — Name of the sensor.
  • position (List[float], optional, defaults to [0, 0, 0]) — Position of the sensor in the scene.
  • rotation (List[float], optional, defaults to [0, 0, 0]) — Rotation of the sensor in the scene.
  • scaling (List[float], optional, defaults to [1, 1, 1]) — Scaling of the sensor in the scene.
  • transformation_matrix (List[float], optional, defaults to None) — Transformation matrix of the sensor in the scene.
  • parent (Asset, optional, defaults to None) — Parent of the sensor in the scene.
  • children (List[Asset], optional, defaults to None) — Children of the sensor in the scene.
  • created_from_file (str, optional, defaults to None) — The path to the file from which the sensor was created.

A State sensor: pointer to two assets whose positions/rotations are used to compute an observation

class simulate.RaycastSensor

< >

( n_horizontal_rays: int = 1 n_vertical_rays: int = 1 horizontal_fov: float = 0.0 vertical_fov: float = 0.0 ray_length: float = 100.0 sensor_tag: str = 'RaycastSensor' name: dataclasses.InitVar[typing.Optional[str]] = None position: dataclasses.InitVar[typing.Optional[typing.List[float]]] = <property object at 0x7f9e74dcf630> rotation: dataclasses.InitVar[typing.Optional[typing.List[float]]] = <property object at 0x7f9e74dcf900> scaling: dataclasses.InitVar[typing.Union[float, typing.List[float], NoneType]] = <property object at 0x7f9e74dcf720> transformation_matrix: dataclasses.InitVar[typing.Optional[typing.List[float]]] = <property object at 0x7f9e74dcf6d0> parent: dataclasses.InitVar[typing.Optional[ForwardRef('Asset')]] = None children: dataclasses.InitVar[typing.Optional[typing.List[ForwardRef('Asset')]]] = None created_from_file: dataclasses.InitVar[typing.Optional[str]] = None )

Parameters

  • n_horizontal_rays (int, optional, defaults to 1) — The number of horizontal rays to cast.
  • n_vertical_rays (int, optional, defaults to 1) — The number of vertical rays to cast.
  • horizontal_fov (float, optional, defaults to 0.0) — The horizontal field of view of the sensor.
  • vertical_fov (float, optional, defaults to 0.0) — The vertical field of view of the sensor.
  • ray_length (float, optional, defaults to 100.0) — The length of the ray to cast.
  • sensor_tag (str, optional, defaults to "RaycastSensor") — The tag of the sensor.
  • name (str, optional, defaults to None) — The name of the sensor.
  • position (List[float], optional, defaults to None) — The position of the sensor in the scene.
  • rotation (List[float], optional, defaults to None) — The rotation of the sensor in the scene.
  • scaling (List[float], optional, defaults to None) — The scaling of the sensor in the scene.
  • transformation_matrix (List[float], optional, defaults to None) — The transformation matrix of the sensor in the scene.
  • parent (Asset, optional, defaults to None) — The parent of the sensor.
  • children (List[Asset], optional, defaults to None) — The children of the sensor.
  • created_from_file (str, optional, defaults to None) — The path to the file from which the sensor was created.

A Raycast sensor: cast a ray to get an observation.