fixed baraomter issue (skip first few readings due to sensor errors)

added new eval using shortest-path + plotting
removed compiler warnings for clean-code
fixed some minor issues
added new TeX code and new graphics
This commit is contained in:
2016-02-07 13:30:04 +01:00
parent 004d1f48fd
commit deb21fc550
23 changed files with 4480 additions and 51 deletions

View File

@@ -1,6 +1,6 @@
#pragma once
#include "circular.h"
//#include "circular.h"
#include "BarometerObservation.h"
#include "../reader/SensorReader.h"
#include <sstream>
@@ -23,6 +23,9 @@ private:
static constexpr int avgSize = 10;
static constexpr int startAvgSize = 10;
// skip the first 1-2 seconds and let the sensor settle itself
uint64_t skipTS = 0;
public:
BarometerSensorReader(): avg(avgSize), avgStart(startAvgSize) {
@@ -30,16 +33,21 @@ public:
}
BarometerObservation* readBarometer(const SensorEntry& se) {
// skip the first few 1.5 seconds
if (skipTS == 0) {skipTS = se.ts;}
if (se.ts - skipTS < 3000) {return nullptr;}
std::string tmp = se.data;
BarometerObservation* obs = new BarometerObservation();
const float cur = std::stof(tmp);
// get the next hPa reading and average it
avg.add(std::stof(tmp));
avg.add(cur);
// average the first few readings as reference
if (avgStart.getNumUsed() < startAvgSize) {
avgStart.add(std::stof(tmp));
avgStart.add(cur);
}
// current average relative to the start-average
@@ -50,13 +58,13 @@ public:
}
//TODO
void readVerticalAcceleration(const SensorEntry& se){
// //TODO
// void readVerticalAcceleration(const SensorEntry& se){
//Problem: Koordinatensystem LinearAcceleraton ist relativ zum Telefon und nicht zum
//Weltkoordinatensystem. Brauchen die Beschleunigung nach Oben in Weltkoordinaten.
// //Problem: Koordinatensystem LinearAcceleraton ist relativ zum Telefon und nicht zum
// //Weltkoordinatensystem. Brauchen die Beschleunigung nach Oben in Weltkoordinaten.
}
// }
};