SimpleFOClibrary 2.4.0
Loading...
Searching...
No Matches
GenericSensor Class Reference

#include <GenericSensor.h>

Inheritance diagram for GenericSensor:
[legend]
Collaboration diagram for GenericSensor:
[legend]

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
 

Detailed Description

Definition at line 10 of file GenericSensor.h.

Constructor & Destructor Documentation

◆ GenericSensor()

GenericSensor::GenericSensor ( float(*)()  readCallback = nullptr,
void(*)()  initCallback = nullptr 
)

GenericSensor class constructor

Parameters
readCallbackpointer to the function reading the sensor angle
initCallbackpointer to the function initialising the sensor

Definition at line 9 of file GenericSensor.cpp.

Member Function Documentation

◆ getSensorAngle()

float GenericSensor::getSensorAngle ( )
overridevirtual

get current angle (rad)

Implements Sensor.

Definition at line 24 of file GenericSensor.cpp.

◆ init()

void GenericSensor::init ( )
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.

Here is the call graph for this function:

Member Data Documentation

◆ initCallback

void(* GenericSensor::initCallback) () = nullptr

function pointer to sensor initialisation

Definition at line 20 of file GenericSensor.h.

◆ readCallback

float(* GenericSensor::readCallback) () = nullptr

function pointer to sensor reading

Definition at line 19 of file GenericSensor.h.


The documentation for this class was generated from the following files: