added fixed interval smoothing

This commit is contained in:
toni
2016-03-17 19:24:45 +01:00
parent 8d2be0f8a0
commit 89bb0b8b7a
17 changed files with 1010 additions and 137 deletions

View File

@@ -11,6 +11,8 @@
#include "../lukas/StepEvaluation.h"
#include "../lukas/TurnEvaluation.h"
#include <atomic>
class MyEvaluation : public K::ParticleFilterEvaluation<MyState, MyObservation> {
private:
@@ -47,6 +49,11 @@ public:
double sum = 0;
for (K::Particle<MyState>& p : particles) {
// std::atomic<double> sum(0);
// #pragma omp parallel for
// for (int i = 0; i < (int) particles.size(); ++i) {
// K::Particle<MyState>& p = particles[i];
double weight = 1.0;
if (useWifi) {
@@ -55,6 +62,9 @@ public:
if (useBaro && observation.barometer) {
weight *= barometerEval.getProbability(p.state, observation.barometer);
// set
p.state.measurement_pressure = observation.barometer->hpa;
}
if (useIB) {

View File

@@ -23,6 +23,12 @@ struct MyState {
// the grid-walk state
GridWalkState<MyGridNode> walkState;
// cumulative heading
double cumulativeHeading;
// save last hPa measurement for the smoothing process
double measurement_pressure;
//int distanceWalkedCM;

View File

@@ -87,6 +87,9 @@ public:
// update the old heading and the other old values
//p.state.walkState.heading = p.state.heading;
if(!(p.state.pOld == p.state.pCur)){
p.state.cumulativeHeading = Angle::getDEG_360(p.state.pOld.x, p.state.pOld.y, p.state.pCur.x, p.state.pCur.y);
}
p.state.pOld = p.state.pCur;