DynAIkonTrap.sensor#

An interface to the sensor board. The logs from sensor readings are taken by the SensorLogs and can be accessed via the SensorLogs.get() function, by timestamp. The intended usage is to retrieve a sensor log taken at a similar time to a frame.

Classes

Reading(value[, units])

Representation of a sensor reading, which has a value and units of measurement

Sensor(port, baud, obfuscation_distance_km)

Provides an interface to the weather sensor board

SensorLog(system_time, readings)

A log of sensor readings taken at a given moment in time.

SensorLogs(settings)

A data structure to hold all sensor logs.

class Reading(value: float, units: Optional[Union[str, Type[None]]] = None)#

Representation of a sensor reading, which has a value and units of measurement

units: Union[str, Type[None]] = None#
value: float#
class Sensor(port: str, baud: int, obfuscation_distance_km: float)#

Provides an interface to the weather sensor board

Parameters:
  • port (str) – The path to the port to which the sensor is attached, most likely '/dev/ttyUSB0'

  • baud (int) – Baudrate to use in communication with the sensor board

  • obfuscation_distance_km (float) – Dimension of squares for quantising GPS location

Raises:

SerialException – If the sensor board could not be found

read() SensorLog#

Triggers the taking and logging of sensor readings

Returns:

Readings for all sensors

Return type:

SensorLog

class SensorLog(system_time: float, readings: Dict[str, Reading])#

A log of sensor readings taken at a given moment in time. system_time is represented as a UNIX-style timestamp. If a reading could not be taken for any of the attached sensors, the sensor may be represented by None in the log.

readings: Dict[str, Reading]#
serialise()#
system_time: float#
class SensorLogs(settings: SensorSettings)#

A data structure to hold all sensor logs. The class includes a dedicated process to perform the sensor logging and handle sensor log lookup requests.

Parameters:

settings (SensorSettings) – Settings for the sensor logger

Raises:

SerialException – If the sensor board could not be found

close()#
get(timestamp: float) Union[SensorLog, Type[None]]#

Get the log closest to the given timestamp and return it.

Also deletes logs older than this timestamp.

Parameters:

timestamp (float) – Timestamp of the image for which sensor readings are to be retrieved

Returns:

The retrieved log of sensor readings or None if none could be retrieved.

Return type:

Union[SensorLog, None]

property read_interval#