added new tex comments/details

worked on evaluation
stair sanitizing
added stair-plotting (for debug)
This commit is contained in:
2016-02-06 15:06:47 +01:00
parent 716b004f3c
commit 004d1f48fd
11 changed files with 452 additions and 107 deletions

View File

@@ -27,72 +27,10 @@ public:
pf = new K::ParticleFilter<MyState, MyControl, MyObservation>( MiscSettings::numParticles, std::unique_ptr<MyInitializer>(new MyInitializer(grid, 1120, 150, 3*350, 90)) );
std::vector<int> wp = path1;// 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<MyGridNode>* walk = new GridWalkRandomHeadingUpdate<MyGridNode>();
//GridWalkRandomHeadingUpdateAdv<MyGridNode>* walk = new GridWalkRandomHeadingUpdateAdv<MyGridNode>();
//GridWalkPushForward<MyGridNode>* walk = new GridWalkPushForward<MyGridNode>();
//GridWalkLightAtTheEndOfTheTunnel<MyGridNode>* walk = new GridWalkLightAtTheEndOfTheTunnel<MyGridNode>(grid, DijkstraMapper(grid), end);
GridWalkSimpleControl<MyGridNode>* walk = new GridWalkSimpleControl<MyGridNode>();
//GridWalkPathControl<MyGridNode>* walk = new GridWalkPathControl<MyGridNode>(grid, DijkstraMapper(grid), end);
pf->setTransition( std::unique_ptr<MyTransition>( 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() {
}
//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() {
runName = "TODO";
// the particle filter's evaluation method
std::unique_ptr<MyEvaluation> eval = std::unique_ptr<MyEvaluation>( new MyEvaluation() );
eval.get()->setUsage(true, true, true, true, true); // TODO: STEP TURN
eval.get()->setUsage(true, true, true, true, true);
pf->setEvaluation( std::move(eval) );
// resampling step?
@@ -105,8 +43,208 @@ public:
//pf->setEstimation( std::unique_ptr<K::ParticleFilterEstimationRegionalWeightedAverage<MyState>>(new K::ParticleFilterEstimationRegionalWeightedAverage<MyState>()));
//pf->setEstimation( std::unique_ptr<K::ParticleFilterEstimationOrderedWeightedAverage<MyState>>(new K::ParticleFilterEstimationOrderedWeightedAverage<MyState>(0.50f)));
// std::vector<int> 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<MyGridNode>* walk = new GridWalkRandomHeadingUpdate<MyGridNode>();
// //GridWalkRandomHeadingUpdateAdv<MyGridNode>* walk = new GridWalkRandomHeadingUpdateAdv<MyGridNode>();
// //GridWalkPushForward<MyGridNode>* walk = new GridWalkPushForward<MyGridNode>();
// //GridWalkLightAtTheEndOfTheTunnel<MyGridNode>* walk = new GridWalkLightAtTheEndOfTheTunnel<MyGridNode>(grid, DijkstraMapper(grid), end);
// //GridWalkSimpleControl<MyGridNode>* walk = new GridWalkSimpleControl<MyGridNode>();
// GridWalkPathControl<MyGridNode>* walk = new GridWalkPathControl<MyGridNode>(grid, DijkstraMapper(grid), end);
// pf->setTransition( std::unique_ptr<MyTransition>( 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<MyGridNode>* walk = new GridWalkSimpleControl<MyGridNode>();
pf->setTransition( std::unique_ptr<MyTransition>( 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<MyGridNode>* walk = new GridWalkPathControl<MyGridNode>(grid, DijkstraMapper(grid), end);
pf->setTransition( std::unique_ptr<MyTransition>( 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<MyGridNode>* walk = new GridWalkSimpleControl<MyGridNode>();
pf->setTransition( std::unique_ptr<MyTransition>( 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<MyGridNode>* walk = new GridWalkPathControl<MyGridNode>(grid, DijkstraMapper(grid), end);
pf->setTransition( std::unique_ptr<MyTransition>( 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<MyGridNode>* walk = new GridWalkSimpleControl<MyGridNode>();
pf->setTransition( std::unique_ptr<MyTransition>( 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<MyGridNode>* walk = new GridWalkSimpleControl<MyGridNode>();
pf->setTransition( std::unique_ptr<MyTransition>( 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<MyGridNode>* walk = new GridWalkPathControl<MyGridNode>(grid, DijkstraMapper(grid), end);
pf->setTransition( std::unique_ptr<MyTransition>( 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<MyEvaluation> eval = std::unique_ptr<MyEvaluation>( 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<K::ParticleFilterResamplingSimple<MyState>>(new K::ParticleFilterResamplingSimple<MyState>()) );
// //pf->setResampling( std::unique_ptr<K::ParticleFilterResamplingPercent<MyState>>(new K::ParticleFilterResamplingPercent<MyState>(0.10)) );
// // state estimation step
// pf->setEstimation( std::unique_ptr<K::ParticleFilterEstimationWeightedAverage<MyState>>(new K::ParticleFilterEstimationWeightedAverage<MyState>()));
// //pf->setEstimation( std::unique_ptr<K::ParticleFilterEstimationRegionalWeightedAverage<MyState>>(new K::ParticleFilterEstimationRegionalWeightedAverage<MyState>()));
// //pf->setEstimation( std::unique_ptr<K::ParticleFilterEstimationOrderedWeightedAverage<MyState>>(new K::ParticleFilterEstimationOrderedWeightedAverage<MyState>(0.50f)));
// }
};
#endif // EVAL1_H

View File

@@ -59,6 +59,7 @@ protected:
std::vector<int> path2 = {19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 23, 7, 6};
std::vector<int> path3 = {5, 27, 26, 255, 25, 4, 3, 2, 215, 1, 0, 30, 31};
std::vector<int> path4 = {29, 28, 27, 32, 33, 34, 35, 36, 10, 9, 8, 22, 37, 38, 39, 40, 41, 42, 43, 44};
std::vector<int> path4dbl = {29, 29, 28, 27, 32, 33, 34, 35, 36, 10, 9, 8, 22, 37, 38, 39, 40, 41, 42, 43, 44}; // duplicate 1st waypoint!
public:
@@ -252,8 +253,8 @@ public:
const Point3 curGT = gtw.getPosAtTime(se.ts - offset);
const Point3 diff = curEst - curGT;
// skip the first 8 scans due to uniform distribution start
if (++cnt > 8) {
// skip the first 10 scans due to uniform distribution start
if (++cnt > 10) {
pathEst.push_back(curEst);
const float err = diff.length();
stats.add(err);

View File

@@ -21,6 +21,7 @@ public:
K::GnuplotSplotElementLines floors;
K::GnuplotSplotElementColorPoints nodes;
K::GnuplotSplotElementLines edges;
public:
@@ -28,9 +29,13 @@ public:
floors.setLineWidth(2);
plot.add(&edges);
plot.add(&nodes);
plot.add(&floors);
nodes.setPointSize(0.7);
edges.setColorHex("#555555");
gp << "set ticslevel 0\n";
@@ -89,6 +94,40 @@ public:
}
/** show all nodes (and edges?) within the given region */
template <typename T> void debugGrid(Grid<T>& grid, const BBox3& bbox, const bool addNodes, const bool addEdges) {
std::set<uint64_t> used;
for (T& n1 : grid) {
if (bbox.contains(n1)) {
const K::GnuplotPoint3 p1(n1.x_cm, n1.y_cm, n1.z_cm);
if (addNodes) {
nodes.add(p1, 0);
}
if (addEdges) {
for (const T& n2 : grid.neighbors(n1)) {
if (n1.z_cm == n2.z_cm) {continue;} // speedup
if (used.find(n2.getIdx()) == used.end()) {
const K::GnuplotPoint3 p2(n2.x_cm, n2.y_cm, n2.z_cm);
edges.addSegment(p1, p2);
}
}
used.insert(n1.getIdx());
// for (const T& n2 : grid.neighbors(n1)) {
// const uint64_t idx = n1.getIdx() * n2.getIdx();
// if (used.find(idx) == used.end()) {
// const K::GnuplotPoint3 p2(n2.x_cm, n2.y_cm, n2.z_cm);
// edges.addSegment(p1, p2);
// used.insert(idx);
// }
// }
}
}
}
}
};

111
code/eval/PaperVisGrid.h Normal file
View File

@@ -0,0 +1,111 @@
#ifndef PAPERVISGRID_H
#define PAPERVISGRID_H
#include <Indoor/grid/Grid.h>
#include <Indoor/grid/factory/GridFactory.h>
#include <Indoor/grid/factory/GridImportance.h>
#include <Indoor/floorplan/FloorplanFactorySVG.h>
#include <Indoor/grid/walk/GridWalkLightAtTheEndOfTheTunnel.h>
#include <Indoor/nav/dijkstra/Dijkstra.h>
#include <Indoor/nav/dijkstra/DijkstraPath.h>
#include "PaperPlot.h"
#include "PaperPlot2D.h"
#include "../MyGridNode.h"
#include "../Settings.h"
#include "../Helper.h"
class PaperVisGrid {
public:
static void showStairs() {
// the grid
Grid<MyGridNode> grid(20);
// floors
Helper::FHWSFloors floors = Helper::getFloors();
Helper::buildTheGrid(grid, floors);
// // load the floorplan
// FloorplanFactorySVG fpFac(MiscSettings::floorplan, 2.822222);
// Floor f0 = fpFac.getFloor("floor_0");
// Floor f0 = fpFac.getFloor("floor_1");
// const LengthF h0 = LengthF::cm(0);
// const LengthF h1 = LengthF::cm(400);
// const LengthF h2 = LengthF::cm(400+340);
// const LengthF h3 = LengthF::cm(400+340+340);
// add the floorplan to the grid
// GridFactory<MyGridNode> gridFac(grid);
// gridFac.addFloor(f0, h0.cm());
// gridFac.addFloor(f1, h1.cm());
// gridFac.addFloor(f2, h2.cm());
// gridFac.addFloor(f3, h3.cm());
// remove all isolated nodes not attached to 300,300,floor0
// gridFac.removeIsolated( (MyGridNode&)grid.getNodeFor( GridPoint(300,300,h0.cm()) ) );
PaperPlot plot;
// stairwell low left
{BBox3 bbox;
bbox.add(Point3(1300, 650,000));
bbox.add(Point3(2000,1300,1400));
plot.debugGrid(grid, bbox, true, true);}
// stairwell upper left
{BBox3 bbox;
bbox.add(Point3(1200,4758,000));
bbox.add(Point3(1800,5158,1400));
plot.debugGrid(grid, bbox, true, true);}
// stairwell upper right
{BBox3 bbox;
bbox.add(Point3(6240,4718,000));
bbox.add(Point3(6830,5158,1400));
plot.debugGrid(grid, bbox, true, true);}
// stair left
{BBox3 bbox;
bbox.add(Point3(1200,3200,000));
bbox.add(Point3(1440,4078,1400));
plot.debugGrid(grid, bbox, true, true);}
// stair center
{BBox3 bbox;
bbox.add(Point3(4200,4118,100));
bbox.add(Point3(6120,4438,1400));
plot.debugGrid(grid, bbox, true, true);}
//stair lower right
{BBox3 bbox;
bbox.add(Point3(7360,3358,000));
bbox.add(Point3(7880,4300,500));
plot.debugGrid(grid, bbox, true, true);}
plot.show();
sleep(1000);
}
};
#endif // PAPERVISGRID_H