added gps support

added compass support
added ui elements for gps and compass
added support for writing sensor data
This commit is contained in:
2017-03-21 16:27:14 +01:00
parent c7c94cbebe
commit b0712ec005
24 changed files with 586 additions and 30 deletions

View 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

View File

@@ -0,0 +1,46 @@
#ifndef GPSSENSORDUMMY_H
#define GPSSENSORDUMMY_H
#include "../GPSSensor.h"
#include "RandomSensor.h"
#include <random>
class GPSSensorDummy : public RandomSensor<GPSData, GPSSensor> {
private:
std::thread thread;
/** hidden ctor */
GPSSensorDummy() : RandomSensor(Timestamp::fromMS(1000)) {
;
}
public:
/** singleton access */
static GPSSensorDummy& get() {
static GPSSensorDummy gps;
return gps;
}
protected:
std::minstd_rand gen;
std::uniform_real_distribution<float> distNoise = std::uniform_real_distribution<float>(-0.09, +0.09);
GPSData getRandomEntry() override {
const Timestamp ts = Timestamp::fromRunningTime();
const float lat = 49.7773992;
const float lon = 9.9627029;
const float alt = 100;
return GPSData(ts, lat, lon, alt);
}
};
#endif // GPSSENSORDUMMY_H

View File

@@ -7,6 +7,8 @@
#include "AccelerometerSensorDummy.h"
#include "GyroscopeSensorDummy.h"
#include "BarometerSensorDummy.h"
#include "GPSSensorDummy.h"
#include "CompassSensorDummy.h"
/**
* sensor factory that provides sensors that fire dummy data
@@ -31,6 +33,14 @@ public:
return BarometerSensorDummy::get();
}
CompassSensor& getCompass() override {
return CompassSensorDummy::get();
}
GPSSensor& getGPS() override {
return GPSSensorDummy::get();
}
};
#endif // SENSORFACTORYDUMMY_H