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
< source >( 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 to256
) — The width of the Camera. Default: 256 -
height (
int
, optional, defaults to256
) — The height of the Camera. Default: 256 -
camera_type (
str
, optional, defaults toperspective
) — The type of camera. Can be one of: [ “perspective”, “orthographic” ] -
znear (
float
, optional, defaults to0.3
) — The near clipping plane of the Camera. -
yfov (
float
ornp.ndarray
, optional, defaults to60
) — The vertical field of view of the Camera in degrees. -
aspect_ratio (
float
, optional, defaults toNone
) — The aspect ratio of the Camera if needed -
zfar (
float
, optional, defaults toNone
) — The far clipping plane of the Camera. -
xmag (
float
, optional, defaults toNone
) — The x magnification of the Camera. -
ymag (
float
, optional, defaults toNone
) — The y magnification of the Camera. -
name (
str
, optional, defaults toNone
) — The name of the Camera. -
sensor_tag (
str
, optional, defaults toCameraSensor
) — 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
orList[float]
, optional, defaults to1.0
) — The scaling of the Camera. -
is_actor (
bool
, optional, defaults toFalse
) — Whether the Camera is an actor. -
parent (
Asset
, optional, defaults toNone
) — The parent of the Camera. -
children (
List[Asset]
, optional, defaults toNone
) — The children of the Camera.
A Camera asset. This Camera is located at the origin by default and has no rotation.
copy
< source >( with_children: bool = True **kwargs: typing.Any )
Make a copy of the Camera with copy of the children attached to the copy.
class simulate.StateSensor
< source >( 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 0x7fe8df5334a0> rotation: dataclasses.InitVar[typing.Optional[typing.List[float]]] = <property object at 0x7fe8df533310> scaling: dataclasses.InitVar[typing.Union[float, typing.List[float], NoneType]] = <property object at 0x7fe8df533360> transformation_matrix: dataclasses.InitVar[typing.Optional[typing.List[float]]] = <property object at 0x7fe8df5333b0> 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
orstr
, optional, defaults toNone
) — Reference or name of the target Asset in the scene. -
reference_entity (
Asset
orstr
, optional, defaults toNone
) — Reference or name of the reference Asset in the scene. If no reference is provided we use the world as a reference. -
properties (
str
orList[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 toNone
) — 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 toNone
) — Transformation matrix of the sensor in the scene. -
parent (
Asset
, optional, defaults toNone
) — Parent of the sensor in the scene. -
children (
List[Asset]
, optional, defaults toNone
) — Children of the sensor in the scene. -
created_from_file (
str
, optional, defaults toNone
) — 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
< source >( 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 0x7fe8df533b80> rotation: dataclasses.InitVar[typing.Optional[typing.List[float]]] = <property object at 0x7fe8df533e50> scaling: dataclasses.InitVar[typing.Union[float, typing.List[float], NoneType]] = <property object at 0x7fe8df533c70> transformation_matrix: dataclasses.InitVar[typing.Optional[typing.List[float]]] = <property object at 0x7fe8df533c20> 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 to1
) — The number of horizontal rays to cast. -
n_vertical_rays (
int
, optional, defaults to1
) — The number of vertical rays to cast. -
horizontal_fov (
float
, optional, defaults to0.0
) — The horizontal field of view of the sensor. -
vertical_fov (
float
, optional, defaults to0.0
) — The vertical field of view of the sensor. -
ray_length (
float
, optional, defaults to100.0
) — The length of the ray to cast. -
sensor_tag (
str
, optional, defaults to"RaycastSensor"
) — The tag of the sensor. -
name (
str
, optional, defaults toNone
) — The name of the sensor. -
position (
List[float]
, optional, defaults toNone
) — The position of the sensor in the scene. -
rotation (
List[float]
, optional, defaults toNone
) — The rotation of the sensor in the scene. -
scaling (
List[float]
, optional, defaults toNone
) — The scaling of the sensor in the scene. -
transformation_matrix (
List[float]
, optional, defaults toNone
) — The transformation matrix of the sensor in the scene. -
parent (
Asset
, optional, defaults toNone
) — The parent of the sensor. -
children (
List[Asset]
, optional, defaults toNone
) — The children of the sensor. -
created_from_file (
str
, optional, defaults toNone
) — The path to the file from which the sensor was created.
A Raycast sensor: cast a ray to get an observation.