From 3451e96444d85578a4d6d4f7559edfab9bed43cd Mon Sep 17 00:00:00 2001 From: kazu Date: Wed, 10 May 2017 21:38:53 +0200 Subject: [PATCH] current TeX --- main.cpp | 165 ++++++++++++++++++++++++++--------- plots/Plotty.h | 3 +- tex/chapters/experiments.tex | 22 ++++- 3 files changed, 143 insertions(+), 47 deletions(-) diff --git a/main.cpp b/main.cpp index 6c08a20..74b5db7 100755 --- a/main.cpp +++ b/main.cpp @@ -1068,28 +1068,51 @@ void compareAll() { 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); + const float s = 2.0; + K::GnuplotSplotElementLines lineGT; lineGT.getStroke().setWidth(16); lineGT.getStroke().getColor().setHexStr("#999999"); - 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 line1; line1.setTitle("\\noOptEmpiric{}"); line1.getStroke().getColor().setHexStr("#ff0000"); line1.getStroke().setType(K::GnuplotDashtype::DOTTED); line1.getStroke().setWidth(2*s); + K::GnuplotSplotElementLines line1b; line1b.getStroke().getColor().setHexStr("#ff0000"); line1b.getStroke().setWidth(5*s); - 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 line2; line2.setTitle("\\optPerFloor{}"); line2.getStroke().getColor().setHexStr("#0000ff"); line2.getStroke().setType(K::GnuplotDashtype::DASHED); line2.getStroke().setWidth(2*s); + K::GnuplotSplotElementLines line2b; p.splot.add(&line2b); line2b.getStroke().getColor().setHexStr("#0000ff"); line2b.getStroke().setWidth(5*s); - K::GnuplotSplotElementLines line4; line4.setTitle("PF + \\noOptEmpiric{}"); - K::GnuplotSplotElementLines line4b; line4b.getStroke().setWidth(4); + K::GnuplotSplotElementLines line3; line3.setTitle("PF + \\optPerFloor{}"); line3.getStroke().getColor().setHexStr("#00cc00"); line3.getStroke().setWidth(2*s); + K::GnuplotSplotElementLines line3b; line3b.getStroke().getColor().setHexStr("#00cc00"); line3b.getStroke().setWidth(8*s); + + K::GnuplotSplotElementLines line4; line4.getStroke().setWidth(1.5*s); line4.setTitle("PF + \\noOptEmpiric{}"); + K::GnuplotSplotElementLines line4b; line4b.getStroke().setWidth(1.5*s); - p2.splot.add(&line4); // the failing path - p2.splot.add(&line4b); // the failing path + p.splot.add(&lineGT); + p2.splot.add(&lineGT); + + p.splot.add(&line2); + p.splot.add(&line2b); + p.splot.add(&line1); + p.splot.add(&line1b); + + + p.splot.add(&line3); + p.splot.add(&line3b); + p.splot.add(&line4); + p.splot.add(&line4b); + + + + + + //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); + - 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 @@ -1101,6 +1124,7 @@ void compareAll() { pet.setColor(0, "#ff0000"); pet.setLabel(0, "\\noOptEmpiric{}"); pet.getStroke(0).setType(K::GnuplotDashtype::DOTTED); + pet.setWidth(0, 3); // OPT_PER_FLOOR MovingAVG avga2(12); @@ -1108,12 +1132,14 @@ void compareAll() { pet.setColor(1, "#0000ff"); pet.setLabel(1, "\\optPerFloor{}"); pet.getStroke(1).setType(K::GnuplotDashtype::DASHED); + pet.setWidth(1, 3); // PARTICLE FILTER MovingAVG 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{}"); + pet.setWidth(2, 3); auto isOutdoor = [] (const Timestamp ts) { return ts.sec() > 95 && ts.sec() < 119; @@ -1169,22 +1195,26 @@ void compareAll() { if (isOutdoor(e.ts)) {line3b.add(gp3);} } + const Walk gtPoints = FloorplanHelper::getGroundTruth(map, Settings::GroundTruth::path1); + for (const Point3 pt : gtPoints) { + const K::GnuplotPoint3 gp3(pt.x, pt.y, pt.z); + lineGT.add(gp3); + } + // failing walk + const Point3 failOffset(0, 1, 0); // offset. visibility 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); + const K::GnuplotPoint3 offset(failOffset.x, failOffset.y, failOffset.z); + line4.add(gp3 + offset); 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"); + p.addStartIndicator(res1.entries[0].estimation, "#ff0000", 1.25); + p.addStartIndicator(res2.entries[0].estimation, "#0000ff", 1.25); + p.addStartIndicator(res3.entries[0].estimation, "#00cc00", 1.25); - 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"; @@ -1194,18 +1224,26 @@ void compareAll() { 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().setSampleLength(1.0); 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.splot.getView().setScaleAll(3.9); + //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.splot.getView().setScaleAll(3.3); + p.gp.setTerminal("epslatex", K::GnuplotSize(8.3*1.75, 4.8*1.75)); p.gp.writePlotToFile(Settings::fPathGFX + "final3D.gp"); p.gp.setOutput(Settings::fPathGFX + "final3D.tex"); + + p.plot(); p2.splot.getCustom() << "set view equal xy\n"; @@ -1222,23 +1260,68 @@ void compareAll() { 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(""); + //line1.setTitle(""); + //line2.setTitle(""); + //line3.setTitle(""); p2.splot.getKey().setVisible(true); - p2.splot.getKey().setPosition(K::GnuplotCoordinate2(0.53, 1.0, K::GnuplotCoordinateSystem::SCREEN)); - //p2.splot.getKey().setPosition(K::GnuplotCoordinate2(0.71, 0.35, K::GnuplotCoordinateSystem::SCREEN)); + //p2.splot.getKey().setPosition(K::GnuplotCoordinate2(0.53, 1.0, K::GnuplotCoordinateSystem::SCREEN)); + p2.splot.getKey().setPosition(K::GnuplotCoordinate2(0.71, 0.45, 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.splot.getView().setScaleAll(4.2); + //p2.gp.setTerminal("epslatex", K::GnuplotSize(8.3, 4.8)); + //p2.setScale(1,1, 0.02, -0.04); + + K::GnuplotObjectPolygon* ps1 = p2.addStartIndicator(res1.entries[0].estimation, "#ff0000", 1.25); + K::GnuplotObjectPolygon* ps2 = p2.addStartIndicator(res2.entries[0].estimation, "#0000ff", 1.25); + K::GnuplotObjectPolygon* ps3 = p2.addStartIndicator(res3.entries[0].estimation, "#00aa00", 1.25); + K::GnuplotObjectPolygon* ps4 = p2.addStartIndicator(res4.entries[0].estimation+failOffset, "#000000", 1.25); + + + ps1->setEnabled(true); + ps2->setEnabled(true); + ps3->setEnabled(false); + ps4->setEnabled(false); + p2.splot.add(&line2); + p2.splot.add(&line2b); + p2.splot.add(&line1); + p2.splot.add(&line1b); + p2.splot.getKey().setWidthIncrement(6.0); + p2.splot.getKey().setPosition(K::GnuplotCoordinate2(0.55, 0.48, K::GnuplotCoordinateSystem::SCREEN)); + p2.gp.setTerminal("epslatex", K::GnuplotSize(8.0, 4.7)); + p2.gp.writePlotToFile(Settings::fPathGFX + "final2D-a.gp"); + p2.gp.setOutput(Settings::fPathGFX + "final2D-a.tex"); p2.plot(); + ps1->setEnabled(false); + ps2->setEnabled(false); + ps3->setEnabled(true); + ps4->setEnabled(true); + p2.splot.remove(&line1); + p2.splot.remove(&line1b); + p2.splot.remove(&line2); + p2.splot.remove(&line2b); + p2.splot.add(&line3); + p2.splot.add(&line3b); + p2.splot.add(&line4); + p2.splot.add(&line4b); + p2.splot.getKey().setWidthIncrement(4.5); + p2.splot.getKey().setPosition(K::GnuplotCoordinate2(0.78, 0.48, K::GnuplotCoordinateSystem::SCREEN)); + p2.gp.setTerminal("epslatex", K::GnuplotSize(8.0, 4.7)); + p2.gp.writePlotToFile(Settings::fPathGFX + "final2D-b.gp"); + p2.gp.setOutput(Settings::fPathGFX + "final2D-b.tex"); + p2.plot(); + + + + // bigger + //p2.splot.getKey().setPosition(K::GnuplotCoordinate2(0.25, 1.0, K::GnuplotCoordinateSystem::SCREEN)); + //p2.splot.getView().setScaleAll(3.5); + //p2.gp.setTerminal("epslatex", K::GnuplotSize(8.3*1.75, 4.8*1.75)); + //p2.setScale(1,1, 0.01, -0.02); + int i = 0; (void) i; @@ -1256,9 +1339,9 @@ int main(void) { //plotAllWalks(map); - //compareAll(); + compareAll(); - //return 0; + return 0; //testWAF(); //sleep(1); @@ -1455,7 +1538,7 @@ int main(void) { // wifi vs ground-truth distance error - if (1 == 1) { + if (1 == 0) { std::vector files = { Settings::path1a, Settings::path1b, diff --git a/plots/Plotty.h b/plots/Plotty.h index 5a466e2..0bc2e31 100755 --- a/plots/Plotty.h +++ b/plots/Plotty.h @@ -342,13 +342,12 @@ public: splot.getObjects().add(poly); } - K::GnuplotObjectPolygon* addStartIndicator(const Point3 pt, const std::string& color) { + K::GnuplotObjectPolygon* addStartIndicator(const Point3 pt, const std::string& color, const float s = 2) { // for (const Point3 p : points) { // if (p.z < settings.minZ) {return nullptr;} // if (p.z > settings.maxZ) {return nullptr;} // } - const float s = 2.0; K::GnuplotObjectPolygon* poly = new K::GnuplotObjectPolygon(); poly->setFill(K::GnuplotFill(K::GnuplotFillStyle::SOLID, K::GnuplotColor::fromHexStr(color))); poly->setStroke(K::GnuplotStroke(K::GnuplotDashtype::SOLID, 1, K::GnuplotColor::fromRGB(0,0,0))); diff --git a/tex/chapters/experiments.tex b/tex/chapters/experiments.tex index fb3d507..1a8a5f1 100755 --- a/tex/chapters/experiments.tex +++ b/tex/chapters/experiments.tex @@ -705,13 +705,26 @@ building prevents the density from entering, due to a very high difference between model and real-world conditions. \begin{figure} - \begin{subfigure}{0.49\textwidth} + %\begin{subfigure}{0.49\textwidth} + % \centering + % \input{gfx/final3D.tex} + %\end{subfigure} + %\begin{subfigure}{0.49\textwidth} + % \centering + % \input{gfx/final2D.tex} + %\end{subfigure} + \begin{subfigure}{0.99\textwidth} \centering \input{gfx/final3D.tex} \end{subfigure} - \begin{subfigure}{0.49\textwidth} + \\\vspace{4mm} + \begin{subfigure}{0.48\textwidth} \centering - \input{gfx/final2D.tex} + \input{gfx/final2D-a.tex} + \end{subfigure} + \begin{subfigure}{0.48\textwidth} + \centering + \input{gfx/final2D-b.tex} \end{subfigure} \\ \begin{subfigure}{0.99\textwidth} @@ -723,7 +736,8 @@ is increased (bold line). A particle filter (PF, \refeq{eq:recursiveDensity}) on top of the optimized model takes \SI{5}{\second} to initialize the starting-position (rectangles), fixes the outdoor-issue and improves indoor situations. A filter on top of {\em \noOptEmpiric{}} got stuck right before - entering the 2nd building. + entering the 2nd building. Both, the filtered and unfiltered version of {\em \noOptEmpiric{}} + are dragged into the 2nd floor in the middle of the walk. } \label{fig:final} \end{figure}