How to use it
The SensorArray
class represents an array of sensors and provides methods to read and manage them.
Methods
addSensor(sensor: Sensor): SensorArray
Adds a sensor to the array.
Parameters:
sensor
: The sensor to add.
Returns: The updated
SensorArray
instance.
readAllLoopSaving()
Reads all sensors. Should be used every loop at the beginning.
allTelemetry(telemetry: Telemetry)
Provides telemetry for all sensors.
Parameters:
telemetry
: The telemetry to use.
telemetry(telemetry: Telemetry, name: String)
Provides telemetry for an individual sensor.
Parameters:
telemetry
: The telemetry to use.name
: The name of the sensor.
read(name: String, type: SensorData): Any
Reads an individual sensor.
Parameters:
name
: The name of the sensor.type
: The type of sensor data.
Returns: The sensor data.
autoLoop(loops: Int)
Reads all sensors at its periodic interval.
Parameters:
loops
: The number of loops,loopTimeController.loops
.
autoLoop(ltc: LoopTimeController)
Reads all sensors at its periodic interval.
Parameters:
ltc
: TheLoopTimeController
to use.