#ifndef EVAL1_H #define EVAL1_H #include "EvalBase.h" #include "../DijkstraMapper.h" #include #include #include #include #include #include #include #include #include #include #include class Eval1 : public EvalBase { public: Eval1() { pf = new K::ParticleFilter( MiscSettings::numParticles, std::unique_ptr(new MyInitializer(grid, 1120, 150, 3*350, 90)) ); std::unique_ptr eval = std::unique_ptr( new MyEvaluation() ); eval.get()->setUsage(true, true, true, true, true); pf->setEvaluation( std::move(eval) ); // resampling step? pf->setNEffThreshold(1.0); pf->setResampling( std::unique_ptr>(new K::ParticleFilterResamplingSimple()) ); //pf->setResampling( std::unique_ptr>(new K::ParticleFilterResamplingPercent(0.10)) ); // state estimation step pf->setEstimation( std::unique_ptr>(new K::ParticleFilterEstimationWeightedAverage())); //pf->setEstimation( std::unique_ptr>(new K::ParticleFilterEstimationRegionalWeightedAverage())); //pf->setEstimation( std::unique_ptr>(new K::ParticleFilterEstimationOrderedWeightedAverage(0.50f))); // std::vector wp = path2;// std::reverse(wp.begin(), wp.end()); // MyGridNode& start = (MyGridNode&)grid.getNodeFor( conv(floors.gtwp[wp.front()]) ); // MyGridNode& end = (MyGridNode&)grid.getNodeFor( conv(floors.gtwp[wp.back()]) ); // //GridWalkRandomHeadingUpdate* walk = new GridWalkRandomHeadingUpdate(); // //GridWalkRandomHeadingUpdateAdv* walk = new GridWalkRandomHeadingUpdateAdv(); // //GridWalkPushForward* walk = new GridWalkPushForward(); // //GridWalkLightAtTheEndOfTheTunnel* walk = new GridWalkLightAtTheEndOfTheTunnel(grid, DijkstraMapper(grid), end); // //GridWalkSimpleControl* walk = new GridWalkSimpleControl(); // GridWalkPathControl* walk = new GridWalkPathControl(grid, DijkstraMapper(grid), end); // pf->setTransition( std::unique_ptr( new MyTransition(grid, *walk)) ); // // path1 //// sr = new SensorReader("./measurements/path1/1/1454345312844.csv"); // forward //// srt = new SensorReaderTurn("./measurements/path1/1/Turns.txt"); //// srs = new SensorReaderStep("./measurements/path1/1/Steps2.txt"); //// sr = new SensorReader("./measurements/path1/2/1454345421125.csv"); // backward //// srt = new SensorReaderTurn("./measurements/path1/2/Turns.txt"); //// srs = new SensorReaderStep("./measurements/path1/2/Steps2.txt"); // // path2 // sr = new SensorReader("./measurements/path2/1/1454345775306.csv"); // forward // srt = new SensorReaderTurn("./measurements/path2/1/Turns.txt"); // srs = new SensorReaderStep("./measurements/path2/1/Steps2.txt"); // //sr = new SensorReader("./measurements/path2/2/1454346071347.csv"); // backward // //srt = new SensorReaderTurn("./measurements/path2/2/Turns.txt"); // //srs = new SensorReaderStep("./measurements/path2/2/Steps2.txt"); // // path3 //// sr = new SensorReader("./measurements/path3/1/1454345546308.csv"); // forward //// srt = new SensorReaderTurn("./measurements/path3/1/Turns.txt"); //// srs = new SensorReaderStep("./measurements/path3/1/Steps2.txt"); //// sr = new SensorReader("./measurements/path3/2/1454345622819.csv"); // backward //// srt = new SensorReaderTurn("./measurements/path3/2/Turns.txt"); //// srs = new SensorReaderStep("./measurements/path3/2/Steps2.txt"); // // path4 //// sr = new SensorReader("./measurements/path4/1454595382218.csv"); // forward //// srt = new SensorReaderTurn("./measurements/path4/Turns.txt"); //// srs = new SensorReaderStep("./measurements/path4/Steps2.txt"); // gtw = getGroundTruthWay(*sr, floors.gtwp, wp); } void setEvalFails() { } /** * starting with bad barometer readings. takes some time to move upwards * will be fixed by using the path */ void path2_forward_simple() { // forward runName = "path2_forward_simple"; sr = new SensorReader("./measurements/path2/1/1454345775306.csv"); srt = new SensorReaderTurn("./measurements/path2/1/Turns.txt"); srs = new SensorReaderStep("./measurements/path2/1/Steps2.txt"); gtw = getGroundTruthWay(*sr, floors.gtwp, path2); GridWalkSimpleControl* walk = new GridWalkSimpleControl(); pf->setTransition( std::unique_ptr( new MyTransition(grid, *walk)) ); } void path2_forward_path() { // forward runName = "path2_forward_path"; sr = new SensorReader("./measurements/path2/1/1454345775306.csv"); srt = new SensorReaderTurn("./measurements/path2/1/Turns.txt"); srs = new SensorReaderStep("./measurements/path2/1/Steps2.txt"); gtw = getGroundTruthWay(*sr, floors.gtwp, path2); MyGridNode& end = (MyGridNode&)grid.getNodeFor( conv(floors.gtwp[path2.back()]) ); GridWalkPathControl* walk = new GridWalkPathControl(grid, DijkstraMapper(grid), end); pf->setTransition( std::unique_ptr( new MyTransition(grid, *walk)) ); } // TODO: plot grid-nodes for stairs for the paper (also look at z-transitions. some have NO x/y change even though they should have!) void path3_forward_simple() { // forward runName = "path3_forward_simple"; sr = new SensorReader("./measurements/path3/1/1454345546308.csv"); // forward srt = new SensorReaderTurn("./measurements/path3/1/Turns.txt"); srs = new SensorReaderStep("./measurements/path3/1/Steps2.txt"); gtw = getGroundTruthWay(*sr, floors.gtwp, path3); GridWalkSimpleControl* walk = new GridWalkSimpleControl(); pf->setTransition( std::unique_ptr( new MyTransition(grid, *walk)) ); } void path3_forward_path() { // looks like the left stairs here are NOT working as expected?! // plot them // look at the probability-draw, maybe there is an issue there // forward runName = "path3_forward_path"; sr = new SensorReader("./measurements/path3/1/1454345546308.csv"); // forward srt = new SensorReaderTurn("./measurements/path3/1/Turns.txt"); srs = new SensorReaderStep("./measurements/path3/1/Steps2.txt"); gtw = getGroundTruthWay(*sr, floors.gtwp, path3); MyGridNode& end = (MyGridNode&)grid.getNodeFor( conv(floors.gtwp[path3.back()]) ); GridWalkPathControl* walk = new GridWalkPathControl(grid, DijkstraMapper(grid), end); pf->setTransition( std::unique_ptr( new MyTransition(grid, *walk)) ); } void path4_nexus_simple() { runName = "path4_nexus_simple"; sr = new SensorReader("./measurements/path4/nexus/1454695040555.csv"); // forward srt = new SensorReaderTurn("./measurements/path4/nexus/Turns.txt"); srs = new SensorReaderStep("./measurements/path4/nexus/Steps2.txt"); gtw = getGroundTruthWay(*sr, floors.gtwp, path4dbl); // remove importance for (auto& n : grid) {n.imp = 1;} GridWalkSimpleControl* walk = new GridWalkSimpleControl(); pf->setTransition( std::unique_ptr( new MyTransition(grid, *walk)) ); } void path4_nexus_imp() { runName = "path4_nexus_importance"; sr = new SensorReader("./measurements/path4/nexus/1454695040555.csv"); // forward srt = new SensorReaderTurn("./measurements/path4/nexus/Turns.txt"); srs = new SensorReaderStep("./measurements/path4/nexus/Steps2.txt"); gtw = getGroundTruthWay(*sr, floors.gtwp, path4dbl); GridWalkSimpleControl* walk = new GridWalkSimpleControl(); pf->setTransition( std::unique_ptr( new MyTransition(grid, *walk)) ); } void path4_nexus_path() { runName = "path4_nexus_path"; sr = new SensorReader("./measurements/path4/nexus/1454695040555.csv"); // forward srt = new SensorReaderTurn("./measurements/path4/nexus/Turns.txt"); srs = new SensorReaderStep("./measurements/path4/nexus/Steps2.txt"); gtw = getGroundTruthWay(*sr, floors.gtwp, path4dbl); MyGridNode& end = (MyGridNode&)grid.getNodeFor( conv(floors.gtwp[path4dbl.back()]) ); GridWalkPathControl* walk = new GridWalkPathControl(grid, DijkstraMapper(grid), end); pf->setTransition( std::unique_ptr( new MyTransition(grid, *walk)) ); } //wifi also uniform dist 0/1 fuer bereiche die OK sind? //steps hochzaehlen weil mehr als einer in einer transition?? //increase regional average region // void setEval1() { // // the particle filter's evaluation method // std::unique_ptr eval = std::unique_ptr( new MyEvaluation() ); // eval.get()->setUsage(true, true, true, true, true); // TODO: STEP TURN // pf->setEvaluation( std::move(eval) ); // // resampling step? // pf->setNEffThreshold(1.0); // pf->setResampling( std::unique_ptr>(new K::ParticleFilterResamplingSimple()) ); // //pf->setResampling( std::unique_ptr>(new K::ParticleFilterResamplingPercent(0.10)) ); // // state estimation step // pf->setEstimation( std::unique_ptr>(new K::ParticleFilterEstimationWeightedAverage())); // //pf->setEstimation( std::unique_ptr>(new K::ParticleFilterEstimationRegionalWeightedAverage())); // //pf->setEstimation( std::unique_ptr>(new K::ParticleFilterEstimationOrderedWeightedAverage(0.50f))); // } }; #endif // EVAL1_H