added gps support
added compass support added ui elements for gps and compass added support for writing sensor data
This commit is contained in:
43
sensors/dummy/CompassSensorDummy.h
Normal file
43
sensors/dummy/CompassSensorDummy.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef COMPASSSENSORDUMMY_H
|
||||
#define COMPASSSENSORDUMMY_H
|
||||
|
||||
#include "../CompassSensor.h"
|
||||
#include "RandomSensor.h"
|
||||
#include <random>
|
||||
|
||||
class CompassSensorDummy : public RandomSensor<CompassData, CompassSensor> {
|
||||
|
||||
private:
|
||||
|
||||
std::thread thread;
|
||||
|
||||
/** hidden ctor */
|
||||
CompassSensorDummy() : RandomSensor(Timestamp::fromMS(100)) {
|
||||
;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/** singleton access */
|
||||
static CompassSensorDummy& get() {
|
||||
static CompassSensorDummy compass;
|
||||
return compass;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
std::minstd_rand gen;
|
||||
std::uniform_real_distribution<float> distNoise = std::uniform_real_distribution<float>(-0.07, +0.07);
|
||||
|
||||
CompassData getRandomEntry() override {
|
||||
|
||||
const Timestamp ts = Timestamp::fromRunningTime();
|
||||
|
||||
const float azimuth = 0 + std::sin(ts.sec()) * 0.5 + distNoise(gen);
|
||||
return CompassData(azimuth);
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // COMPASSSENSORDUMMY_H
|
||||
Reference in New Issue
Block a user