worked on synthetic sensor data

This commit is contained in:
2017-12-13 13:25:53 +01:00
parent ade2425fbd
commit 1114331fd2
4 changed files with 38 additions and 9 deletions

View File

@@ -25,8 +25,11 @@ private:
/** the walker to listen to */
SyntheticWalker* walker;
/** the pedestrian's step-size (in meter) */
float stepSize_m = 0.7;
///** the pedestrian's step-size (in meter) */
//float stepSize_m = 0;
///** when walking stairs, the step size is much smaller */
//float stepSizeStair_m = 0;
float lastStepAtDistance = 0;
@@ -46,13 +49,14 @@ private:
//float stepSizeSigma_m;
float noiseLevel;
Distribution::Normal<float> dNextStep;
Distribution::Normal<float> dNextStepStair;
public:
/** ctor with the walker to follow */
SyntheticSteps(SyntheticWalker* walker, const float stepSize_m = 0.7, const float stepSizeSigma_m = 0.1, const float noiseLevel = 0.33) :
SyntheticSteps(SyntheticWalker* walker, const float stepSize_m = 0.7, const float stepSizeStair_m = 0.3, const float stepSizeSigma_m = 0.1, const float noiseLevel = 0.33) :
//stepSize_m(stepSize_m), drift(drift), stepSizeSigma_m(stepSizeSigma_m),
noiseLevel(noiseLevel), dNextStep(stepSize_m, stepSizeSigma_m) {
noiseLevel(noiseLevel), dNextStep(stepSize_m, stepSizeSigma_m), dNextStepStair(stepSizeStair_m, stepSizeSigma_m) {
walker->addListener(this);
dX.setSeed(1);
@@ -87,10 +91,11 @@ public:
protected:
void onWalk(const Timestamp walkedTime, float walkedDistance, const Point3 curPos) override {
void onWalk(const Timestamp walkedTime, float walkedDistance, const Point3 curPos, const SyntheticWalker::Type type) override {
(void) curPos;
const float nextStepAt = lastStepAtDistance + dNextStep.draw();
const float distAdd = (type == SyntheticWalker::Type::FLOOR) ? (dNextStep.draw()) : (dNextStepStair.draw());
const float nextStepAt = lastStepAtDistance + distAdd;
// 1st, start with random noise on the accelerometer
const float x = dX.draw();