current TeX
minor code changes
This commit is contained in:
269
main.cpp
269
main.cpp
@@ -749,7 +749,7 @@ void paperOutputs() {
|
||||
}
|
||||
|
||||
/** plot wifi eval results */
|
||||
if (1 == 0) {
|
||||
if (1 == 1) {
|
||||
|
||||
WiFiFingerprints fps;
|
||||
fps.load(Settings::fCalib);
|
||||
@@ -791,15 +791,14 @@ void paperOutputs() {
|
||||
|
||||
p2->gp.writePlotToFile(Settings::fPathGFX + "wifiMaxErrorNN_opt3.gp");
|
||||
p2->gp.setOutput(Settings::fPathGFX + "wifiMaxErrorNN_opt3.tex");
|
||||
//p2->gp << "set colorbox horizontal user origin screen 0.4, 0.96 size 0.5,0.05\n";
|
||||
p2->splot.setStringMod(new K::GnuplotStringModLaTeX());
|
||||
adjust(p2);
|
||||
|
||||
p3->gp.writePlotToFile(Settings::fPathGFX + "wifiMaxErrorNN_opt5.gp");
|
||||
p3->gp.setOutput(Settings::fPathGFX + "wifiMaxErrorNN_opt5.tex");
|
||||
p3->gp << "set pm3d; set cbrange [0:20]; set palette defined (0 '#ffffff', 1 '#ff0000'); \n";
|
||||
//p3->gp << "set colorbox horizontal user origin screen -0.11, 0.08 size 0.45,0.05 front;\n";
|
||||
p3->gp << "set colorbox vertical user origin screen 0.77, 0.55 size 0.04,0.40 front;\n";
|
||||
p3->splot.getCustom() << "set pm3d; set cbrange [0:20]; set palette defined (0 '#ffffff', 1 '#ff0000'); \n";
|
||||
//p3->splot.getCustom() << "set colorbox horizontal user origin screen -0.11, 0.08 size 0.45,0.05 front;\n";
|
||||
p3->splot.getCustom() << "set colorbox vertical user origin screen 0.77, 0.55 size 0.04,0.40 front;\n";
|
||||
p3->splot.getAxisCB().setTicsLabelFormat("%h dB");
|
||||
p3->splot.getAxisCB().setTicsStep(10);
|
||||
p3->splot.setStringMod(new K::GnuplotStringModLaTeX());
|
||||
@@ -960,10 +959,261 @@ void showModelFor(const std::string& mapFile, const std::string& modelXml, const
|
||||
|
||||
}
|
||||
|
||||
void compareAll() {
|
||||
|
||||
Floorplan::IndoorMap* map = Floorplan::Reader::readFromFile(Settings::fMap);
|
||||
|
||||
// std::vector<std::string> files = {
|
||||
// Settings::path1a, //Settings::path1b,
|
||||
// //Settings::path2a, Settings::path2b,
|
||||
// //Settings::path_toni_all_1a, Settings::path_toni_all_1b,
|
||||
// //Settings::path_toni_all_2a, Settings::path_toni_all_2b,
|
||||
// //Settings::path_toni_inst_1a, Settings::path_toni_inst_1b,
|
||||
// //Settings::path_toni_inst_2a, Settings::path_toni_inst_2b,
|
||||
// //Settings::path_toni_inst_3a, Settings::path_toni_inst_3b,
|
||||
// };
|
||||
// std::vector<std::vector<int>> gtIndices = {
|
||||
// Settings::GroundTruth::path1, //Settings::GroundTruth::path1,
|
||||
// //Settings::GroundTruth::path2, Settings::GroundTruth::path2,
|
||||
// //Settings::GroundTruth::path1, Settings::GroundTruth::path1,
|
||||
// //Settings::GroundTruth::path2, Settings::GroundTruth::path2,
|
||||
// //Settings::GroundTruth::path_toni_inst_1, Settings::GroundTruth::path_toni_inst_1,
|
||||
// //Settings::GroundTruth::path_toni_inst_2, Settings::GroundTruth::path_toni_inst_2,
|
||||
// //Settings::GroundTruth::path_toni_inst_3, Settings::GroundTruth::path_toni_inst_3,
|
||||
// };
|
||||
|
||||
const std::string path = Settings::path1a;
|
||||
const std::vector<int> gtIndices = Settings::GroundTruth::path1;
|
||||
|
||||
WalkResult res1;
|
||||
WalkResult res2;
|
||||
WalkResult res3;
|
||||
WalkResult res4;
|
||||
// {
|
||||
// EvalWiFiPaths ewp1(Settings::fMap);
|
||||
// ewp1.loadModel(Settings::wifiAllFixed, "A");
|
||||
// res1 = ewp1.walk(path, gtIndices);
|
||||
// res1.serialize("/tmp/walk1.dat");
|
||||
// }
|
||||
|
||||
// {
|
||||
// EvalWiFiPaths ewp2(Settings::fMap);
|
||||
// ewp2.loadModel(Settings::wifiEachOptParPos_multimodel, "B");
|
||||
// res2 = ewp2.walk(path, gtIndices);
|
||||
// res2.serialize("/tmp/walk2.dat");
|
||||
// }
|
||||
|
||||
// {
|
||||
// EvalWalk ew(map);
|
||||
// ew.walk(path, gtIndices, Settings::wifiEachOptParPos_multimodel);
|
||||
// ew.res.serialize("/tmp/walk3.dat");
|
||||
// }
|
||||
|
||||
// {
|
||||
// EvalWalk ew(map);
|
||||
// ew.walk(path, gtIndices, Settings::wifiAllFixed);
|
||||
// ew.res.serialize("/tmp/walk4.dat");
|
||||
// }
|
||||
|
||||
res1.deserialize("/tmp/walk1.dat");
|
||||
res2.deserialize("/tmp/walk2.dat");
|
||||
res3.deserialize("/tmp/walk3.dat");
|
||||
res4.deserialize("/tmp/walk4.dat");
|
||||
|
||||
PlotErrTime pet("time", "error (m)", "");
|
||||
pet.getPlot().getAxisY().setRange(0, 25);
|
||||
|
||||
|
||||
|
||||
Plotty p(map);
|
||||
p.buildFloorplan();
|
||||
|
||||
Plotty p2(map);
|
||||
p2.settings.maxZ = 4.1;
|
||||
p2.buildFloorplan();
|
||||
|
||||
K::GnuplotSplotElementLines line1; p.splot.add(&line1); line1.setTitle("\\noOptEmpiric{}"); line1.getStroke().getColor().setHexStr("#ff0000"); line1.getStroke().setType(K::GnuplotDashtype::DOTTED); line1.getStroke().setWidth(2);
|
||||
K::GnuplotSplotElementLines line1b; p.splot.add(&line1b); line1b.getStroke().getColor().setHexStr("#ff0000"); line1b.getStroke().setWidth(5);
|
||||
|
||||
K::GnuplotSplotElementLines line2; p.splot.add(&line2); line2.setTitle("\\optPerFloor{}"); line2.getStroke().getColor().setHexStr("#0000ff"); line2.getStroke().setType(K::GnuplotDashtype::DASHED); line2.getStroke().setWidth(2);
|
||||
K::GnuplotSplotElementLines line2b; p.splot.add(&line2b); line2b.getStroke().getColor().setHexStr("#0000ff"); line2b.getStroke().setWidth(5);
|
||||
|
||||
K::GnuplotSplotElementLines line3; p.splot.add(&line3); line3.setTitle("PF + \\optPerFloor{}"); line3.getStroke().getColor().setHexStr("#00dd00"); line3.getStroke().setWidth(2);
|
||||
K::GnuplotSplotElementLines line3b; p.splot.add(&line3b); line3b.getStroke().getColor().setHexStr("#00dd00"); line3b.getStroke().setWidth(6);
|
||||
|
||||
K::GnuplotSplotElementLines line4; line4.setTitle("PF + \\noOptEmpiric{}");
|
||||
K::GnuplotSplotElementLines line4b; line4b.getStroke().setWidth(4);
|
||||
|
||||
|
||||
p2.splot.add(&line4); // the failing path
|
||||
p2.splot.add(&line4b); // the failing path
|
||||
|
||||
p2.splot.add(&line1);
|
||||
p2.splot.add(&line1b);
|
||||
p2.splot.add(&line2);
|
||||
p2.splot.add(&line2b);
|
||||
p2.splot.add(&line3);
|
||||
p2.splot.add(&line3b);
|
||||
|
||||
|
||||
// ERROR OVER TIME
|
||||
int ms;
|
||||
|
||||
// EMPIRIC
|
||||
MovingAVG<float> avga1(12);
|
||||
for (const WalkResult::Entry& e : res1.entries) {avga1.add(e.err); pet.addErr(e.ts, avga1.get(), 0); ms += 500;}
|
||||
pet.setColor(0, "#ff0000");
|
||||
pet.setLabel(0, "\\noOptEmpiric{}");
|
||||
pet.getStroke(0).setType(K::GnuplotDashtype::DOTTED);
|
||||
|
||||
// OPT_PER_FLOOR
|
||||
MovingAVG<float> avga2(12);
|
||||
for (const WalkResult::Entry& e : res2.entries) {avga2.add(e.err); pet.addErr(e.ts, avga2.get(), 1); ms += 500;}
|
||||
pet.setColor(1, "#0000ff");
|
||||
pet.setLabel(1, "\\optPerFloor{}");
|
||||
pet.getStroke(1).setType(K::GnuplotDashtype::DASHED);
|
||||
|
||||
// PARTICLE FILTER
|
||||
MovingAVG<float> avga3(3);
|
||||
for (const WalkResult::Entry& e : res3.entries) {avga3.add(e.err); pet.addErr(e.ts, avga3.get(), 2); ms += 500;}
|
||||
pet.setColor(2, "#00dd00");
|
||||
pet.setLabel(2, "PF + \\optPerFloor{}");
|
||||
|
||||
auto isOutdoor = [] (const Timestamp ts) {
|
||||
return ts.sec() > 95 && ts.sec() < 119;
|
||||
};
|
||||
|
||||
K::GnuplotCoordinate2 rFrom(92, K::GnuplotCoordinateSystem::FIRST, 0, K::GnuplotCoordinateSystem::GRAPH);
|
||||
K::GnuplotCoordinate2 rTo(121, K::GnuplotCoordinateSystem::FIRST, 1, K::GnuplotCoordinateSystem::GRAPH);
|
||||
K::GnuplotFill rFill(K::GnuplotFillStyle::SOLID, K::GnuplotColor::fromRGB(200,200,200));
|
||||
K::GnuplotStroke rStroke = K::GnuplotStroke::NONE();
|
||||
K::GnuplotObjectRectangle rect(rFrom, rTo, rFill, rStroke);
|
||||
pet.getPlot().getObjects().add(&rect);
|
||||
|
||||
pet.getPlot().getKey().setVisible(true);
|
||||
//pet.plot();
|
||||
|
||||
pet.getPlot().getKey().setOpaque(true);
|
||||
pet.getPlot().getKey().setWidthIncrement(5.5);
|
||||
pet.getPlot().getKey().setPosition(K::GnuplotKey::Hor::RIGHT, K::GnuplotKey::Ver::TOP);
|
||||
pet.getPlot().getMargin().set(5, 0.2, 0.1, 2.0);
|
||||
pet.getPlot().getAxisX().setTicsLabelFormat("%h s");
|
||||
pet.getPlot().getAxisX().setLabel("");
|
||||
pet.getPlot().getAxisY().setLabel("error (m)");
|
||||
pet.getPlot().getAxisY().setLabelOffset(2.0, 0);
|
||||
pet.getPlot().setStringMod(new K::GnuplotStringModLaTeX());
|
||||
pet.getGP().setTerminal("epslatex", K::GnuplotSize(7.80*2, 3.0));
|
||||
pet.getGP().writePlotToFile(Settings::fPathGFX + "final-error.gp");
|
||||
pet.getGP().setOutput(Settings::fPathGFX + "final-error.tex");
|
||||
pet.getGP() << "set label 1 '\\footnotesize{outdoor}' at first 98, graph 0.1 front\n";
|
||||
pet.plot();
|
||||
|
||||
MovingAVG<Point3> avg1(15);
|
||||
for (const WalkResult::Entry& e : res1.entries) {
|
||||
avg1.add(e.estimation);
|
||||
const Point3 pt = avg1.get();
|
||||
const K::GnuplotPoint3 gp3(pt.x, pt.y, pt.z);
|
||||
line1.add(gp3);
|
||||
if (isOutdoor(e.ts)) {line1b.add(gp3);}
|
||||
}
|
||||
|
||||
MovingAVG<Point3> avg2(15);
|
||||
for (const WalkResult::Entry& e : res2.entries) {
|
||||
avg2.add(e.estimation);
|
||||
const Point3 pt = avg2.get();
|
||||
const K::GnuplotPoint3 gp3(pt.x, pt.y, pt.z);
|
||||
line2.add(gp3);
|
||||
if (isOutdoor(e.ts)) {line2b.add(gp3);}
|
||||
}
|
||||
|
||||
for (const WalkResult::Entry& e : res3.entries) {
|
||||
const Point3 pt = e.estimation;
|
||||
const K::GnuplotPoint3 gp3(pt.x, pt.y, pt.z);
|
||||
line3.add(gp3);
|
||||
if (isOutdoor(e.ts)) {line3b.add(gp3);}
|
||||
}
|
||||
|
||||
// failing walk
|
||||
for (const WalkResult::Entry& e : res4.entries) {
|
||||
const Point3 pt = e.estimation;
|
||||
const K::GnuplotPoint3 gp3(pt.x, pt.y, pt.z);
|
||||
line4.add(gp3);
|
||||
if (isOutdoor(e.ts)) {line4b.add(gp3);}
|
||||
}
|
||||
|
||||
p.addStartIndicator(res1.entries[0].estimation, "#ff0000");
|
||||
p.addStartIndicator(res2.entries[0].estimation, "#0000ff");
|
||||
p.addStartIndicator(res3.entries[0].estimation, "#00cc00");
|
||||
|
||||
p2.addStartIndicator(res1.entries[0].estimation, "#ff0000");
|
||||
p2.addStartIndicator(res2.entries[0].estimation, "#0000ff");
|
||||
p2.addStartIndicator(res3.entries[0].estimation, "#00cc00");
|
||||
p2.addStartIndicator(res4.entries[0].estimation, "#000000");
|
||||
|
||||
p.splot.getCustom() << "set view equal xy\n";
|
||||
p.splot.getCustom() << "unset border\n";
|
||||
p.splot.getMargin().set(1, 0,0,0);
|
||||
p.splot.getAxisX().setTicsVisible(false);
|
||||
p.splot.getAxisY().setTicsVisible(false);
|
||||
p.splot.getAxisZ().setTicsVisible(false);
|
||||
p.splot.getAxisZ().setRange(K::GnuplotAxis::Range(-8, 19.5));
|
||||
p.splot.getView().setCamera(74,30);
|
||||
p.splot.getView().setScaleAll(3.9);
|
||||
p.splot.getKey().setVisible(true);
|
||||
p.splot.getKey().setSampleLength(0.5);
|
||||
p.splot.getKey().setWidthIncrement(4.5);
|
||||
p.splot.setStringMod(new K::GnuplotStringModLaTeX());
|
||||
|
||||
p.splot.getKey().setOpaque(true);
|
||||
//p.splot.getKey().setPosition(K::GnuplotCoordinate2(0.2, 1.0, K::GnuplotCoordinateSystem::SCREEN));
|
||||
p.splot.getKey().setPosition(K::GnuplotCoordinate2(1.0, 1.0, K::GnuplotCoordinateSystem::SCREEN));
|
||||
p.gp.setTerminal("epslatex", K::GnuplotSize(8.3, 4.8));
|
||||
p.gp.writePlotToFile(Settings::fPathGFX + "final3D.gp");
|
||||
p.gp.setOutput(Settings::fPathGFX + "final3D.tex");
|
||||
p.plot();
|
||||
|
||||
p2.splot.getCustom() << "set view equal xy\n";
|
||||
p2.splot.getCustom() << "unset border\n";
|
||||
p2.splot.getMargin().set(1, 0,0,0);
|
||||
p2.splot.getAxisX().setTicsVisible(false);
|
||||
p2.splot.getAxisY().setTicsVisible(false);
|
||||
p2.splot.getAxisZ().setTicsVisible(false);
|
||||
p2.splot.getAxisZ().setRange(K::GnuplotAxis::Range(-8, 19.5));
|
||||
p2.splot.getView().setCamera(74,30);
|
||||
p2.splot.getView().setScaleAll(3.9);
|
||||
p2.splot.getKey().setVisible(true);
|
||||
p2.splot.getKey().setSampleLength(0.5);
|
||||
p2.splot.getKey().setWidthIncrement(4.5);
|
||||
p2.splot.setStringMod(new K::GnuplotStringModLaTeX());
|
||||
|
||||
|
||||
// only list the additional line within the key
|
||||
line1.setTitle("");
|
||||
line2.setTitle("");
|
||||
line3.setTitle("");
|
||||
|
||||
p2.splot.getKey().setVisible(true);
|
||||
p2.splot.getKey().setPosition(K::GnuplotCoordinate2(0.71, 0.35, K::GnuplotCoordinateSystem::SCREEN));
|
||||
p2.splot.getView().setCamera(0,0);
|
||||
p2.splot.getView().setScaleAll(4.0);
|
||||
p2.gp.setTerminal("epslatex", K::GnuplotSize(8.3, 4.8));
|
||||
p2.gp.writePlotToFile(Settings::fPathGFX + "final2D.gp");
|
||||
p2.gp.setOutput(Settings::fPathGFX + "final2D.tex");
|
||||
p2.setScale(1,1, 0.02, -0.04);
|
||||
p2.plot();
|
||||
|
||||
int i = 0;
|
||||
(void) i;
|
||||
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
|
||||
//Toni::run();
|
||||
//return 0;
|
||||
|
||||
compareAll();
|
||||
|
||||
//Toni::run();
|
||||
return 0;
|
||||
|
||||
Floorplan::IndoorMap* map = Floorplan::Reader::readFromFile(Settings::fMap);
|
||||
|
||||
@@ -973,7 +1223,7 @@ int main(void) {
|
||||
//const float rssi = LogDistanceModel::distanceToRssi(-100, 0, 999);
|
||||
//int i = 0; (void) i;
|
||||
|
||||
// paperOutputs(); return 0;
|
||||
paperOutputs(); return 0;
|
||||
|
||||
//showFingerprintsFor(Settings::fMap, Settings::fCalib, "D8:84:66:4A:4A:D0");
|
||||
//showModelFor(Settings::fMap, Settings::wifiEachOptParPos_multimodel, "D8:84:66:4A:4A:D0");
|
||||
@@ -1072,7 +1322,7 @@ int main(void) {
|
||||
// }
|
||||
|
||||
// walks
|
||||
if (1 == 1) {
|
||||
if (1 == 0) {
|
||||
Floorplan::IndoorMap* map = Floorplan::Reader::readFromFile(Settings::fMap);;
|
||||
//EvalWalk walk(map);
|
||||
//walk.walk1();
|
||||
@@ -1312,5 +1562,4 @@ int main(void) {
|
||||
pef.plot();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user