Skyward boardcore
|
The SensorManager handles sensors initialization and sampling. More...
#include <SensorManager.h>
Public Types | |
using | function_t = std::function<void()> |
using | SensorMap_t = std::map<AbstractSensor*, SensorInfo> |
Public Member Functions | |
SensorManager (const SensorMap_t &sensorsMap) | |
SensorManager (const SensorMap_t &sensorsMap, TaskScheduler *scheduler) | |
~SensorManager () | |
Deallocates samplers (through the samplers vector). | |
bool | start () |
Starts the task scheduler. | |
void | stop () |
Starts the task scheduler. | |
void | enableSensor (AbstractSensor *sensor) |
Enable sampling for the specified sensor. | |
void | disableSensor (AbstractSensor *sensor) |
Disable sampling for the specified sensor. | |
void | enableAllSensors () |
void | disableAllSensors () |
bool | areAllSensorsInitialized () |
Checks whether all the sensors have been initialized correctly. | |
const SensorInfo | getSensorInfo (AbstractSensor *sensor) |
const vector< TaskStatsResult > | getSamplersStats () |
The SensorManager handles sensors initialization and sampling.
Sensors are grouped by sampling period in various SensorSampler objects. These samplers are then added to the scheduler ordered by sampling period. The scheduler then manages the samplers by calling their sampleAndCallback method periodically.
TODO: The SensorManager should be able to reinitialized sensors that have failed previous initializations.
Definition at line 47 of file SensorManager.h.
using Boardcore::SensorManager::function_t = std::function<void()> |
Definition at line 50 of file SensorManager.h.
using Boardcore::SensorManager::SensorMap_t = std::map<AbstractSensor*, SensorInfo> |
Definition at line 51 of file SensorManager.h.
|
explicit |
Definition at line 30 of file SensorManager.cpp.
Boardcore::SensorManager::SensorManager | ( | const SensorMap_t & | sensorsMap, |
TaskScheduler * | scheduler ) |
Definition at line 37 of file SensorManager.cpp.
Boardcore::SensorManager::~SensorManager | ( | ) |
Deallocates samplers (through the samplers vector).
Definition at line 45 of file SensorManager.cpp.
bool Boardcore::SensorManager::areAllSensorsInitialized | ( | ) |
Checks whether all the sensors have been initialized correctly.
Definition at line 100 of file SensorManager.cpp.
void Boardcore::SensorManager::disableAllSensors | ( | ) |
Definition at line 94 of file SensorManager.cpp.
void Boardcore::SensorManager::disableSensor | ( | AbstractSensor * | sensor | ) |
Disable sampling for the specified sensor.
sensor | The sensor to be disabled. |
Definition at line 75 of file SensorManager.cpp.
void Boardcore::SensorManager::enableAllSensors | ( | ) |
Definition at line 88 of file SensorManager.cpp.
void Boardcore::SensorManager::enableSensor | ( | AbstractSensor * | sensor | ) |
Enable sampling for the specified sensor.
sensor | The sensor to be enabled. |
Definition at line 62 of file SensorManager.cpp.
const vector< TaskStatsResult > Boardcore::SensorManager::getSamplersStats | ( | ) |
Definition at line 113 of file SensorManager.cpp.
const SensorInfo Boardcore::SensorManager::getSensorInfo | ( | AbstractSensor * | sensor | ) |
Definition at line 102 of file SensorManager.cpp.
bool Boardcore::SensorManager::start | ( | ) |
Starts the task scheduler.
Definition at line 53 of file SensorManager.cpp.
void Boardcore::SensorManager::stop | ( | ) |
Starts the task scheduler.
Definition at line 60 of file SensorManager.cpp.