-
Notifications
You must be signed in to change notification settings - Fork 5
SensorReading Class
Guankai Zhai edited this page May 6, 2022
·
6 revisions
The SensorReading class is the team's current solution to handling sensor data and relevant faults. It has the following fields and methods:
Private
type
: type of the reading as afault_index_type
objectvalue
: boolean value representing the reading valuefault_status
: whether the reading is faulty (1 means invalid reading and 0 means valid reading)
Public
- `SensorReading(fault_index_type t, float x, bool fault): constructor of a SensorReading Object with the three arguments corresponding to the three fields above
get_value()
: returns the boolean value of the SensorReading objectis_valid()
: returntrue
if the reading is valid andfalse
othersiseset_valid()
: set thefault_status
field to 0 to indicate valid reading; will also toggle the corresponding bit infaults::fault_1/fault_2/fault_3
set_invalid()
: set thefault_status
field to 1 to indicate invalid reading; will also toggle the corresponding bit infaults::fault_1/fault_2/fault_3