From b6532dbe7ff04f42898c76fc0bcc1484a506ad9f Mon Sep 17 00:00:00 2001 From: toni Date: Thu, 21 Apr 2016 09:02:18 +0200 Subject: [PATCH] push for merge --- code/CMakeLists.txt.user | 2 +- code/Settings.h | 2 +- code/eval/FixedLagEvalBase.h | 15 +++++---- code/eval/SmoothingEval1.h | 26 +++++++-------- code/main.cpp | 62 ++++++++++++++++++------------------ 5 files changed, 54 insertions(+), 53 deletions(-) diff --git a/code/CMakeLists.txt.user b/code/CMakeLists.txt.user index 1e2cdf5..9d8028d 100644 --- a/code/CMakeLists.txt.user +++ b/code/CMakeLists.txt.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/code/Settings.h b/code/Settings.h index 2ee4e69..a973399 100644 --- a/code/Settings.h +++ b/code/Settings.h @@ -17,7 +17,7 @@ namespace MiscSettings { const int timeSteps = 500; - const int numParticles = 500; + const int numParticles = 7500; const int lag = 5; diff --git a/code/eval/FixedLagEvalBase.h b/code/eval/FixedLagEvalBase.h index 5eed57e..ab2a7fe 100644 --- a/code/eval/FixedLagEvalBase.h +++ b/code/eval/FixedLagEvalBase.h @@ -294,13 +294,17 @@ public: pathEst.push_back(curEst); const float err = diff.length(); - errorsNorm.push_back(err); + // count number of transitions ++cnt; - + if (cnt > 35) { + statsFiltering.add(err); + errorsNorm.push_back(err); + std::cout << "Filtering: " << se.ts << " " << statsFiltering.asString() << std::endl; + } if(cnt > skip){ //save the current estimation for later smoothing. @@ -335,10 +339,7 @@ public: // skip the first 35 scans due to uniform distribution start - // if (cnt > 35) { - statsFiltering.add(err); - std::cout << "Filtering: " << se.ts << " " << statsFiltering.asString() << std::endl; - //} + const float errSmoothed = diffSmoothed.length(); statsSmoothing.add(errSmoothed); @@ -489,7 +490,7 @@ public: std::ofstream oErrPlot("/tmp/plot_err_" + runName + ".gp"); oErrPlot << "plot \\\n"; oErrPlot << "'err_norm_" << runName << ".dat' with lines, \\\n"; - oErrPlot << "'err_smooth_" << runName << ".dat' using (($$0)+" << skip << "):1 with lines"; + oErrPlot << "'err_smooth_" << runName << ".dat' with lines"; oErrPlot.close(); diff --git a/code/eval/SmoothingEval1.h b/code/eval/SmoothingEval1.h index c245af2..15e77be 100644 --- a/code/eval/SmoothingEval1.h +++ b/code/eval/SmoothingEval1.h @@ -51,9 +51,9 @@ public: //create the backward smoothing filter - bf = new K::BackwardSimulation(50); - //bf = new K::CondensationBackwardFilter; - bf->setSampler( std::unique_ptr>(new K::CumulativeSampler())); + //bf = new K::BackwardSimulation(50); + bf = new K::CondensationBackwardFilter; + //bf->setSampler( std::unique_ptr>(new K::CumulativeSampler())); } @@ -145,7 +145,7 @@ public: bf->setEstimation(std::unique_ptr>(new K::ParticleFilterEstimationWeightedAverage())); if(smoothing_resample) bf->setResampling( std::unique_ptr>(new K::ParticleFilterResamplingSimple()) ); - bf->setTransition(std::unique_ptr( new MySmoothingTransition(&grid)) ); + bf->setTransition(std::unique_ptr( new MySmoothingTransitionExperimental) ); } @@ -164,7 +164,7 @@ public: //Smoothing Variables smoothing_walk_mu = 0.7; smoothing_walk_sigma = 0.5; - smoothing_heading_sigma = 15.0; + smoothing_heading_sigma = 5.0; smoothing_baro_sigma = 0.05; bool smoothing_resample = false; @@ -174,7 +174,7 @@ public: bf->setEstimation(std::unique_ptr>(new K::ParticleFilterEstimationWeightedAverage())); if(smoothing_resample) bf->setResampling( std::unique_ptr>(new K::ParticleFilterResamplingSimple()) ); - bf->setTransition(std::unique_ptr( new MySmoothingTransition(&grid)) ); + bf->setTransition(std::unique_ptr( new MySmoothingTransitionExperimental) ); } void bergwerk_path1_nexus_simple() { @@ -242,7 +242,7 @@ public: bf->setEstimation(std::unique_ptr>(new K::ParticleFilterEstimationWeightedAverage())); if(smoothing_resample) bf->setResampling( std::unique_ptr>(new K::ParticleFilterResamplingSimple()) ); - bf->setTransition(std::unique_ptr( new MySmoothingTransition(&grid)) ); + bf->setTransition(std::unique_ptr( new MySmoothingTransitionExperimental) ); } void bergwerk_path2_nexus_simple() { @@ -311,7 +311,7 @@ public: bf->setEstimation(std::unique_ptr>(new K::ParticleFilterEstimationWeightedAverage())); if(smoothing_resample) bf->setResampling( std::unique_ptr>(new K::ParticleFilterResamplingSimple()) ); - bf->setTransition(std::unique_ptr( new MySmoothingTransition(&grid)) ); + bf->setTransition(std::unique_ptr( new MySmoothingTransitionExperimental) ); } void bergwerk_path3_nexus_simple() { @@ -379,7 +379,7 @@ public: bf->setEstimation(std::unique_ptr>(new K::ParticleFilterEstimationWeightedAverage())); if(smoothing_resample) bf->setResampling( std::unique_ptr>(new K::ParticleFilterResamplingSimple()) ); - bf->setTransition(std::unique_ptr( new MySmoothingTransition(&grid)) ); + bf->setTransition(std::unique_ptr( new MySmoothingTransitionExperimental) ); } void bergwerk_path4_nexus_simple() { @@ -448,7 +448,7 @@ public: bf->setEstimation(std::unique_ptr>(new K::ParticleFilterEstimationWeightedAverage())); if(smoothing_resample) bf->setResampling( std::unique_ptr>(new K::ParticleFilterResamplingSimple()) ); - bf->setTransition(std::unique_ptr( new MySmoothingTransition(&grid)) ); + bf->setTransition(std::unique_ptr( new MySmoothingTransitionExperimental) ); } void bergwerk_path1_galaxy_simple() { @@ -499,7 +499,7 @@ public: bf->setEstimation(std::unique_ptr>(new K::ParticleFilterEstimationWeightedAverage())); if(smoothing_resample) bf->setResampling( std::unique_ptr>(new K::ParticleFilterResamplingSimple()) ); - bf->setTransition(std::unique_ptr( new MySmoothingTransition(&grid)) ); + bf->setTransition(std::unique_ptr( new MySmoothingTransitionExperimental) ); } void bergwerk_path2_galaxy_simple() { @@ -550,7 +550,7 @@ public: bf->setEstimation(std::unique_ptr>(new K::ParticleFilterEstimationWeightedAverage())); if(smoothing_resample) bf->setResampling( std::unique_ptr>(new K::ParticleFilterResamplingSimple()) ); - bf->setTransition(std::unique_ptr( new MySmoothingTransition(&grid)) ); + bf->setTransition(std::unique_ptr( new MySmoothingTransitionExperimental) ); } void bergwerk_path3_galaxy_simple() { @@ -603,7 +603,7 @@ public: bf->setEstimation(std::unique_ptr>(new K::ParticleFilterEstimationWeightedAverage())); if(smoothing_resample) bf->setResampling( std::unique_ptr>(new K::ParticleFilterResamplingSimple()) ); - bf->setTransition(std::unique_ptr( new MySmoothingTransition(&grid)) ); + bf->setTransition(std::unique_ptr( new MySmoothingTransitionExperimental) ); } void bergwerk_path4_galaxy_simple() { diff --git a/code/main.cpp b/code/main.cpp index 9d61fd8..2856c88 100644 --- a/code/main.cpp +++ b/code/main.cpp @@ -88,51 +88,51 @@ void testModelWalk() { int main(void) { // testModelWalk(); - SmoothingEval1 eval; - eval.fixedIntervallSimpleTransPath4(); - eval.run(); +// SmoothingEval1 eval; +// eval.fixedIntervallSimpleTransPath4(); +// eval.run(); //Eval1 eval; //eval.bergwerk_path4_nexus_multi(); //eval.run(); -// {SmoothingEval1 eval; eval.bergwerk_path1_nexus_simple(); eval.run();} -// //{SmoothingEval1 eval; eval.bergwerk_path1_nexus_imp(); eval.run();} -// {SmoothingEval1 eval; eval.bergwerk_path1_nexus_multi(); eval.run();} -// {SmoothingEval1 eval; eval.bergwerk_path1_nexus_shortest(); eval.run();} + //{SmoothingEval1 eval; eval.bergwerk_path1_nexus_simple(); eval.run();} + //{SmoothingEval1 eval; eval.bergwerk_path1_nexus_imp(); eval.run();} + {SmoothingEval1 eval; eval.bergwerk_path1_nexus_multi(); eval.run();} + {SmoothingEval1 eval; eval.bergwerk_path1_nexus_shortest(); eval.run();} -// {SmoothingEval1 eval; eval.bergwerk_path2_nexus_simple(); eval.run();} -// //{SmoothingEval1 eval; eval.bergwerk_path2_nexus_imp(); eval.run();} -// {SmoothingEval1 eval; eval.bergwerk_path2_nexus_multi(); eval.run();} -// {SmoothingEval1 eval; eval.bergwerk_path2_nexus_shortest(); eval.run();} + {SmoothingEval1 eval; eval.bergwerk_path2_nexus_simple(); eval.run();} + //{SmoothingEval1 eval; eval.bergwerk_path2_nexus_imp(); eval.run();} + {SmoothingEval1 eval; eval.bergwerk_path2_nexus_multi(); eval.run();} + {SmoothingEval1 eval; eval.bergwerk_path2_nexus_shortest(); eval.run();} -// {SmoothingEval1 eval; eval.bergwerk_path3_nexus_simple(); eval.run();} -// //{SmoothingEval1 eval; eval.bergwerk_path3_nexus_imp(); eval.run();} -// {SmoothingEval1 eval; eval.bergwerk_path3_nexus_multi(); eval.run();} -// {SmoothingEval1 eval; eval.bergwerk_path3_nexus_shortest(); eval.run();} + {SmoothingEval1 eval; eval.bergwerk_path3_nexus_simple(); eval.run();} + //{SmoothingEval1 eval; eval.bergwerk_path3_nexus_imp(); eval.run();} + {SmoothingEval1 eval; eval.bergwerk_path3_nexus_multi(); eval.run();} + {SmoothingEval1 eval; eval.bergwerk_path3_nexus_shortest(); eval.run();} -// {SmoothingEval1 eval; eval.bergwerk_path4_nexus_simple(); eval.run();} -// {SmoothingEval1 eval; eval.bergwerk_path4_nexus_imp(); eval.run();} -// {SmoothingEval1 eval; eval.bergwerk_path4_nexus_multi(); eval.run();} -// {SmoothingEval1 eval; eval.bergwerk_path4_nexus_shortest(); eval.run();} + {SmoothingEval1 eval; eval.bergwerk_path4_nexus_simple(); eval.run();} + {SmoothingEval1 eval; eval.bergwerk_path4_nexus_imp(); eval.run();} + {SmoothingEval1 eval; eval.bergwerk_path4_nexus_multi(); eval.run();} + {SmoothingEval1 eval; eval.bergwerk_path4_nexus_shortest(); eval.run();} -// {SmoothingEval1 eval; eval.bergwerk_path1_galaxy_simple(); eval.run();} -// {SmoothingEval1 eval; eval.bergwerk_path1_galaxy_multi(); eval.run();} -// {SmoothingEval1 eval; eval.bergwerk_path1_galaxy_shortest(); eval.run();} + {SmoothingEval1 eval; eval.bergwerk_path1_galaxy_simple(); eval.run();} + {SmoothingEval1 eval; eval.bergwerk_path1_galaxy_multi(); eval.run();} + {SmoothingEval1 eval; eval.bergwerk_path1_galaxy_shortest(); eval.run();} -// {SmoothingEval1 eval; eval.bergwerk_path2_galaxy_simple(); eval.run();} -// {SmoothingEval1 eval; eval.bergwerk_path2_galaxy_multi(); eval.run();} -// {SmoothingEval1 eval; eval.bergwerk_path2_galaxy_shortest(); eval.run();} + {SmoothingEval1 eval; eval.bergwerk_path2_galaxy_simple(); eval.run();} + {SmoothingEval1 eval; eval.bergwerk_path2_galaxy_multi(); eval.run();} + {SmoothingEval1 eval; eval.bergwerk_path2_galaxy_shortest(); eval.run();} -// {SmoothingEval1 eval; eval.bergwerk_path3_galaxy_simple(); eval.run();} -// {SmoothingEval1 eval; eval.bergwerk_path3_galaxy_multi(); eval.run();} -// {SmoothingEval1 eval; eval.bergwerk_path3_galaxy_shortest(); eval.run();} + {SmoothingEval1 eval; eval.bergwerk_path3_galaxy_simple(); eval.run();} + {SmoothingEval1 eval; eval.bergwerk_path3_galaxy_multi(); eval.run();} + {SmoothingEval1 eval; eval.bergwerk_path3_galaxy_shortest(); eval.run();} -// {SmoothingEval1 eval; eval.bergwerk_path4_galaxy_simple(); eval.run();} -// {SmoothingEval1 eval; eval.bergwerk_path4_galaxy_multi(); eval.run();} -// {SmoothingEval1 eval; eval.bergwerk_path4_galaxy_shortest(); eval.run();} + {SmoothingEval1 eval; eval.bergwerk_path4_galaxy_simple(); eval.run();} + {SmoothingEval1 eval; eval.bergwerk_path4_galaxy_multi(); eval.run();} + {SmoothingEval1 eval; eval.bergwerk_path4_galaxy_shortest(); eval.run();}