worked on grid-walker and synthetic steps/turns

This commit is contained in:
k-a-z-u
2017-11-29 16:35:29 +01:00
parent 55c061b344
commit 63bc2f3046
5 changed files with 370 additions and 232 deletions

View File

@@ -39,17 +39,23 @@ private:
Distribution::Normal<float> dMaxChange = Distribution::Normal<float>(0.011, 0.003);
Distribution::Normal<float> dChange = Distribution::Normal<float>(1.0, 0.25);
Distribution::Normal<float> dHeadErr = Distribution::Normal<float>(0.15, 0.10); // heading error, slightly biased
Distribution::Uniform<float> dRadDiff = Distribution::Uniform<float>(40,100);
//float headingDrift_rad;
//float headingSigma_rad;
float noiseLevel;
Distribution::Normal<float> dHeadErr;
std::vector<Listener*> listeners;
public:
/** ctor with the walker to follow */
SyntheticTurns(SyntheticWalker* walker) {
SyntheticTurns(SyntheticWalker* walker, const float headingDrift_rad = 0, const float headingSigma_rad = 0, const float noiseLevel = 0) :
//headingDrift_rad(headingDrift_rad), headingSigma_rad(headingSigma_rad),
noiseLevel(noiseLevel + 0.00001f), dHeadErr(headingDrift_rad, headingSigma_rad) {
walker->addListener(this);
dAccX.setSeed(1);
dAccY.setSeed(3);
@@ -57,6 +63,7 @@ public:
dGyroX.setSeed(7);
dGyroY.setSeed(9);
dGyroZ.setSeed(11);
}
/** attach a listener to this provider */
@@ -116,14 +123,14 @@ protected:
// convert to gyro's radians-per-second
const double radPerSec = change * 1000 / deltaTs.ms();;
const float accX = 0.00 + dAccX.draw();
const float accY = 0.00 + dAccY.draw();
const float accZ = 9.81 + dAccZ.draw();
const float accX = 0.00 + dAccX.draw() * (noiseLevel);
const float accY = 0.00 + dAccY.draw() * (noiseLevel);
const float accZ = 9.81 + dAccZ.draw() * (noiseLevel);
AccelerometerData acc(accX, accY, accZ);
const float gyroX = dGyroX.draw();
const float gyroY = dGyroY.draw();
const float gyroZ = dGyroZ.draw() + radPerSec;
const float gyroX = dGyroX.draw() * (noiseLevel);
const float gyroY = dGyroY.draw() * (noiseLevel);
const float gyroZ = dGyroZ.draw() * (noiseLevel) + radPerSec;
GyroscopeData gyro(gyroX, gyroY, gyroZ);
for (Listener* l : listeners) {l->onSyntheticTurnData(walkedTime, acc, gyro);}