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:
@@ -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.
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user