added new eval code for new walkers improved barometer (moving avg and median) floorplan-staircase-fixes disabled step-turn (now part of transition) added abs-orientation-reader (for testing) added beacons
63 lines
1.3 KiB
C++
Executable File
63 lines
1.3 KiB
C++
Executable File
#pragma once
|
|
|
|
#include "circular.h"
|
|
#include "BarometerObservation.h"
|
|
#include "../reader/SensorReader.h"
|
|
#include <sstream>
|
|
|
|
#include <Indoor/math/MovingAVG.h>
|
|
#include <Indoor/math/MovingMedian.h>
|
|
|
|
//circular_buffer<double> measurementHistory(1000);
|
|
|
|
|
|
class BarometerSensorReader{
|
|
|
|
private:
|
|
|
|
// NOTE: median or avg?
|
|
MovingMedian<float> avg;
|
|
MovingMedian<float> avgStart;
|
|
|
|
// avg: lower size, median: bigger still fine
|
|
static constexpr int avgSize = 10;
|
|
static constexpr int startAvgSize = 10;
|
|
|
|
public:
|
|
|
|
BarometerSensorReader(): avg(avgSize), avgStart(startAvgSize) {
|
|
;
|
|
}
|
|
|
|
BarometerObservation* readBarometer(const SensorEntry& se) {
|
|
|
|
std::string tmp = se.data;
|
|
BarometerObservation* obs = new BarometerObservation();
|
|
|
|
// get the next hPa reading and average it
|
|
avg.add(std::stof(tmp));
|
|
|
|
// average the first few readings as reference
|
|
if (avgStart.getNumUsed() < startAvgSize) {
|
|
avgStart.add(std::stof(tmp));
|
|
}
|
|
|
|
// current average relative to the start-average
|
|
obs->hpa = avg.get() - avgStart.get();
|
|
|
|
// done
|
|
return obs;
|
|
|
|
}
|
|
|
|
//TODO
|
|
void readVerticalAcceleration(const SensorEntry& se){
|
|
|
|
//Problem: Koordinatensystem LinearAcceleraton ist relativ zum Telefon und nicht zum
|
|
//Weltkoordinatensystem. Brauchen die Beschleunigung nach Oben in Weltkoordinaten.
|
|
|
|
}
|
|
|
|
|
|
};
|