changed visualisation

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
This commit is contained in:
2016-02-05 20:21:46 +01:00
parent 9e9b6882cd
commit 716b004f3c
15 changed files with 188 additions and 179 deletions

View File

@@ -13,7 +13,6 @@ public:
double getProbability(const MyState& state, const BarometerObservation* obs) const {
//return 1;
// //rho_z
double barometerSigma = 0.12+0.04;//0.09;

View File

@@ -6,6 +6,7 @@
#include <sstream>
#include <Indoor/math/MovingAVG.h>
#include <Indoor/math/MovingMedian.h>
//circular_buffer<double> measurementHistory(1000);
@@ -13,21 +14,19 @@
class BarometerSensorReader{
private:
// circular_buffer<double> measurementHistory;
MovingAVG<float> avg;
// 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(3) {
// if(!USE_STATIC_CIRCULAR_BUFFERING){
// //8.33min
// measurementHistory.reserve(10000);
// }
// else{
// //30 * 500ms = 1,5s
// measurementHistory.reserve(30);
// }
BarometerSensorReader(): avg(avgSize), avgStart(startAvgSize) {
;
}
BarometerObservation* readBarometer(const SensorEntry& se) {
@@ -36,62 +35,19 @@ public:
BarometerObservation* obs = new BarometerObservation();
// get the next hPa reading and average it
avg.add(stod(tmp));
const double hPa = avg.get();
avg.add(std::stof(tmp));
// everything realtive to the first measurement
static double first_hPa = 0;
if (avg.getNumUsed() < avg.getSize()) {first_hPa = avg.get();}
// average the first few readings as reference
if (avgStart.getNumUsed() < startAvgSize) {
avgStart.add(std::stof(tmp));
}
obs->hpa = hPa - first_hPa;
//std::cout << obs->hpa << std::endl;
// current average relative to the start-average
obs->hpa = avg.get() - avgStart.get();
// done
return obs;
// if(USE_BAROMETER_SMOOTHING_RC_LOWPASS){
// //smoothing with alpha value
// if(measurementHistory.size() > 1){
// double alpha = 0.1;
// double lastMeasurement = measurementHistory[measurementHistory.size() - 1];
// currentMeasurement = (alpha * currentMeasurement) + ((1.0 - alpha) * lastMeasurement);
// obs->hpa = currentMeasurement;
// }else{
// obs->hpa = 0;
// }
// measurementHistory.push_back(currentMeasurement);
// }
// else if (USE_BAROMETER_SMOOTHING_HEAD_TAIL){
// currentMeasurement = hPa;
// measurementHistory.push_back(currentMeasurement);
// // calculate the relative air pressure by getting the mean of the first and last three entrys of the history
// // and subtract them.
// if (measurementHistory.size() > 5){
// double meanTail = (measurementHistory[0] + measurementHistory[1] + measurementHistory[2]) / 3.0;
// double meanHead = (measurementHistory[measurementHistory.size() - 1] + measurementHistory[measurementHistory.size() - 2] + measurementHistory[measurementHistory.size() - 3]) / 3.0;
// obs->hpa = meanHead - meanTail;
// }
// else{
// obs->hpa = 0;
// }
// }
// else //no data smoothing
// {
// measurementHistory.push_back(currentMeasurement);
// obs->hpa = currentMeasurement;
// }
// return obs;
}
//TODO