worked on grid-walker

started adding code for synthetic sensor simulation based on given paths
This commit is contained in:
k-a-z-u
2017-10-17 17:10:23 +02:00
parent 3807c621c7
commit 72f083d32a
6 changed files with 311 additions and 21 deletions

View File

@@ -38,11 +38,31 @@ private:
const float upperThreshold = +0.4*0.6f; // + is usually smaller than down (look at graphs)
const float lowerThreshold = -1.5*0.6f; // the 0.8 is for testing!
#ifdef WITH_DEBUG_PLOT
K::Gnuplot gp;
K::GnuplotPlot plot;
K::GnuplotPlotElementLines lineDet;
K::GnuplotPlotElementLines lineX;
K::GnuplotPlotElementLines lineY;
K::GnuplotPlotElementLines lineZ;
Timestamp plotRef;
int plotCnt = 0;
#endif
public:
/** ctor */
StepDetection() : avgLong(Timestamp::fromMS(500), 0), avgShort(Timestamp::fromMS(40), 0) {
;
#ifdef WITH_DEBUG_PLOT
plot.add(&lineX); lineX.getStroke().getColor().setHexStr("#ff0000");
plot.add(&lineY); lineY.getStroke().getColor().setHexStr("#00ff00");
plot.add(&lineZ); lineZ.getStroke().getColor().setHexStr("#0000ff");
plot.add(&lineDet); lineDet.getStroke().getColor().setHexStr("#000000");
#endif
}
/** does the given data indicate a step? */
@@ -73,22 +93,25 @@ public:
step = true;
}
// static K::Gnuplot gp;
// static K::GnuplotPlot plot;
// static K::GnuplotPlotElementLines lines1; plot.add(&lines1);
// static K::GnuplotPlotElementLines lines2; plot.add(&lines2); lines2.setColorHex("#0000ff");
// static Timestamp ref = ts;
// static int i = 0;
#ifdef WITH_DEBUG_PLOT
// //lines1.add( K::GnuplotPoint2((ts-ref).ms(), _delta) );
// lines2.add( K::GnuplotPoint2((ts-ref).ms(), delta) );
if (plotRef.isZero()) {plotRef = ts;}
const Timestamp tsPlot = (ts-plotRef);
// if (++i % 100 == 0) {
// gp.draw(plot);
// gp.flush();
// usleep(1000*25);
// }
//lines1.add( K::GnuplotPoint2((ts-ref).ms(), _delta) );
lineX.add( K::GnuplotPoint2(tsPlot.ms(), acc.x) );
lineY.add( K::GnuplotPoint2(tsPlot.ms(), acc.y) );
lineZ.add( K::GnuplotPoint2(tsPlot.ms(), acc.z) );
lineDet.add( K::GnuplotPoint2(tsPlot.ms(), delta) );
if (++plotCnt % 25 == 0) {
gp.draw(plot);
gp.flush();
//usleep(1000*25);
}
#endif
return step;