![]() |
SimpleFOClibrary 2.4.0
|
#include <GenericSensor.h>
Public Member Functions | |
| GenericSensor (float(*readCallback)()=nullptr, void(*initCallback)()=nullptr) | |
| void | init () override |
| float | getSensorAngle () override |
Public Member Functions inherited from Sensor | |
| virtual float | getMechanicalAngle () |
| virtual float | getAngle () |
| virtual double | getPreciseAngle () |
| virtual float | getVelocity () |
| virtual int32_t | getFullRotations () |
| virtual void | update () |
| virtual int | needsSearch () |
Public Attributes | |
| float(* | readCallback )() = nullptr |
| function pointer to sensor reading | |
| void(* | initCallback )() = nullptr |
| function pointer to sensor initialisation | |
Public Attributes inherited from Sensor | |
| float | min_elapsed_time = 0.000100 |
Additional Inherited Members | |
Protected Attributes inherited from Sensor | |
| float | velocity =0.0f |
| float | angle_prev =0.0f |
| long | angle_prev_ts =0 |
| float | vel_angle_prev =0.0f |
| long | vel_angle_prev_ts =0 |
| int32_t | full_rotations =0 |
| int32_t | vel_full_rotations =0 |
Definition at line 10 of file GenericSensor.h.
| GenericSensor::GenericSensor | ( | float(*)() | readCallback = nullptr, |
| void(*)() | initCallback = nullptr |
||
| ) |
GenericSensor class constructor
| readCallback | pointer to the function reading the sensor angle |
| initCallback | pointer to the function initialising the sensor |
Definition at line 9 of file GenericSensor.cpp.
|
overridevirtual |
|
overridevirtual |
Call Sensor::init() from your sensor subclass's init method if you want smoother startup The base class init() method calls getSensorAngle() several times to initialize the internal fields to current values, ensuring there is no discontinuity ("jump from zero") during the first calls to sensor.getAngle() and sensor.getVelocity()
Reimplemented from Sensor.
Definition at line 15 of file GenericSensor.cpp.
| void(* GenericSensor::initCallback) () = nullptr |
function pointer to sensor initialisation
Definition at line 20 of file GenericSensor.h.
| float(* GenericSensor::readCallback) () = nullptr |
function pointer to sensor reading
Definition at line 19 of file GenericSensor.h.