# Sensors

class stonesoup.sensor.base.PlatformMountable(rotation_offset: StateVector = None, mounting_offset: StateVector = None, movement_controller: Movable = None)[source]

Bases: stonesoup.base.Base, abc.ABC

Base class for any object that can be mounted on a platform.

All PlatformMountables must be mounted on a platform to calculate their position and orientation. To make this easier, if the sensor has a position and/or orientation specified in the constructor, and no platform_system, then the default is to create an internally held “private” platform for the Sensor. This allows the Sensor to control (and set) its own position and orientation.

Parameters
• rotation_offset (StateVector, optional) – A StateVector containing the sensor rotation offsets from the platform’s primary axis (defined as the direction of motion). Defaults to a zero vector with the same length as the Platform’s velocity_mapping

• mounting_offset (StateVector, optional) – A StateVector containing the sensor translation offsets from the platform’s reference point. Defaults to a zero vector with length 3

• movement_controller (Movable, optional) – The Movable object that controls the movement of this sensor. Will be set by the platform if the sensor is assigned to a platform.

rotation_offset: stonesoup.types.array.StateVector

A StateVector containing the sensor rotation offsets from the platform’s primary axis (defined as the direction of motion). Defaults to a zero vector with the same length as the Platform’s velocity_mapping

mounting_offset: stonesoup.types.array.StateVector

A StateVector containing the sensor translation offsets from the platform’s reference point. Defaults to a zero vector with length 3

movement_controller: stonesoup.movable.movable.Movable

The Movable object that controls the movement of this sensor. Will be set by the platform if the sensor is assigned to a platform.

property position: Optional[stonesoup.types.array.StateVector]

The sensor position on a 3D Cartesian plane, expressed as a 3x1 StateVector of Cartesian coordinates in the order $$x,y,z$$.

Note

This property delegates the actual calculation of position to the Sensor’s movement_controller

It is settable if, and only if, the sensor holds its own internal movement_controller.

property orientation: Optional[stonesoup.types.array.StateVector]

A 3x1 StateVector of angles (rad), specifying the sensor orientation in terms of the counter-clockwise rotation around each Cartesian axis in the order $$x,y,z$$. The rotation angles are positive if the rotation is in the counter-clockwise direction when viewed by an observer looking along the respective rotation axis, towards the origin.

Note

This property delegates the actual calculation of orientation to the Sensor’s movement_controller

It is settable if, and only if, the sensor holds its own internal movement_controller.

property velocity: Optional[stonesoup.types.array.StateVector]

The sensor velocity on a 3D Cartesian plane, expressed as a 3x1 StateVector of Cartesian coordinates in the order $$x,y,z$$.

Note

This property delegates the actual calculation of velocity to the Sensor’s movement_controller

It is settable if, and only if, the sensor holds its own internal movement_controller which is a MovingMovable.

class stonesoup.sensor.sensor.Sensor(rotation_offset: StateVector = None, mounting_offset: StateVector = None, movement_controller: Movable = None)[source]

Sensor Base class for general use.

Most properties and methods are inherited from PlatformMountable.

Sensors must have a measure function.

Parameters
• rotation_offset (StateVector, optional) – A StateVector containing the sensor rotation offsets from the platform’s primary axis (defined as the direction of motion). Defaults to a zero vector with the same length as the Platform’s velocity_mapping

• mounting_offset (StateVector, optional) – A StateVector containing the sensor translation offsets from the platform’s reference point. Defaults to a zero vector with length 3

• movement_controller (Movable, optional) – The Movable object that controls the movement of this sensor. Will be set by the platform if the sensor is assigned to a platform.

abstract measure(ground_truths: , noise: = True, **kwargs) [source]

Generate a measurement for a given state

Parameters
Returns

A set of measurements generated from the given states. The timestamps of the measurements are set equal to that of the corresponding states that they were calculated from. Each measurement stores the ground truth path that it was produced from.

Return type

Set[TrueDetection]

class stonesoup.sensor.sensor.SensorSuite(sensors: , attributes_inform: Set[str], rotation_offset: StateVector = None, mounting_offset: StateVector = None, movement_controller: Movable = None)[source]

Sensor composition type

Models a suite of sensors all returning detections at the same ‘time’. Returns all detections in one go. Can append information of the sensors to the metadata of their corresponding detections.

Parameters
• sensors (Sequence[Sensor]) – Suite of sensors to get detections from.

• attributes_inform (Set[str]) – Names of attributes to store the value of at time of detection.

• rotation_offset (StateVector, optional) – A StateVector containing the sensor rotation offsets from the platform’s primary axis (defined as the direction of motion). Defaults to a zero vector with the same length as the Platform’s velocity_mapping

• mounting_offset (StateVector, optional) – A StateVector containing the sensor translation offsets from the platform’s reference point. Defaults to a zero vector with length 3

• movement_controller (Movable, optional) – The Movable object that controls the movement of this sensor. Will be set by the platform if the sensor is assigned to a platform.

sensors: Sequence[stonesoup.sensor.sensor.Sensor]

Suite of sensors to get detections from.

attributes_inform: Set[str]

Names of attributes to store the value of at time of detection.

measure(ground_truths: , noise: = True, **kwargs) [source]

Call each sub-sensor’s measure method in turn. Key word arguments are passed to the measure method of each sensor.

Append additional metadata to each sensor’s set of detections. Which keys are appended is dictated by attributes_inform.

## Passive

class stonesoup.sensor.passive.PassiveElevationBearing(ndim_state: int, mapping: numpy.ndarray, noise_covar: CovarianceMatrix, rotation_offset: StateVector = None, mounting_offset: StateVector = None, movement_controller: Movable = None)[source]

A simple passive sensor that generates measurements of targets, using a CartesianToElevationBearing model, relative to its position.

Note

The current implementation of this class assumes a 3D Cartesian plane.

Parameters
• ndim_state (int) – Number of state dimensions. This is utilised by (and follows in format) the underlying CartesianToElevationBearing model

• mapping (numpy.ndarray) – Mapping between the targets state space and the sensors measurement capability

• noise_covar (CovarianceMatrix) – The sensor noise covariance matrix. This is utilised by (and follow in format) the underlying CartesianToElevationBearing model

• rotation_offset (StateVector, optional) – A StateVector containing the sensor rotation offsets from the platform’s primary axis (defined as the direction of motion). Defaults to a zero vector with the same length as the Platform’s velocity_mapping

• mounting_offset (StateVector, optional) – A StateVector containing the sensor translation offsets from the platform’s reference point. Defaults to a zero vector with length 3

• movement_controller (Movable, optional) – The Movable object that controls the movement of this sensor. Will be set by the platform if the sensor is assigned to a platform.

ndim_state: int

Number of state dimensions. This is utilised by (and follows in format) the underlying CartesianToElevationBearing model

mapping: numpy.ndarray

Mapping between the targets state space and the sensors measurement capability

noise_covar: stonesoup.types.array.CovarianceMatrix

The sensor noise covariance matrix. This is utilised by (and follow in format) the underlying CartesianToElevationBearing model

measure(ground_truths: , noise: = True, **kwargs) [source]

Generate a measurement for a given state

Parameters
Returns

A set of measurements generated from the given states. The timestamps of the measurements are set equal to that of the corresponding states that they were calculated from. Each measurement stores the ground truth path that it was produced from.

Return type

Set[TrueDetection]

## Categorical

class stonesoup.sensor.categorical.HMMSensor(measurement_model: MarkovianMeasurementModel, rotation_offset: StateVector = None, mounting_offset: StateVector = None, movement_controller: Movable = None)[source]

Sensor model that observes a categorical state space and returns categorical measurements.

Measurements are categorical distributions over a finite set of categories $$Z = \{\zeta^n|n\in \mathbf{N}, n\le N\}$$ (for some finite $$N$$).

Parameters
• measurement_model (MarkovianMeasurementModel) – Measurement model to generate detection vectors from

• rotation_offset (StateVector, optional) – A StateVector containing the sensor rotation offsets from the platform’s primary axis (defined as the direction of motion). Defaults to a zero vector with the same length as the Platform’s velocity_mapping

• mounting_offset (StateVector, optional) – A StateVector containing the sensor translation offsets from the platform’s reference point. Defaults to a zero vector with length 3

• movement_controller (Movable, optional) – The Movable object that controls the movement of this sensor. Will be set by the platform if the sensor is assigned to a platform.

measurement_model: stonesoup.models.measurement.categorical.MarkovianMeasurementModel

Measurement model to generate detection vectors from

measure(ground_truths, noise: bool = True, **kwargs)[source]

Generate a categorical measurement for a given set of true categorical state.

Parameters
• ground_truths (Set[CategoricalGroundTruthState]) – A set of CategoricalGroundTruthState.

• noise (bool) – Indicates whether measurement vectors are sampled from and the resultant measurement categories returned instead. These are discrete categories instead of a distribution over the measurement space. They are represented by N-tuples, with all components equal to 0, except at an index corresponding to the relevant category. For example $$e^k$$ indicates that the measurement category is $$\zeta^k$$. If False, the resultant distribution is returned.

Returns

A set of measurements generated from the given states. The timestamps of the measurements are set equal to that of the corresponding states that they were calculated from. Each measurement stores the ground truth path that it was produced from.

Return type