The Arduino code for setting and running an Extended Kalman Filter when placing an accelerometer on a wheel. This code focuses on single axis monitoring and estimation.
How to run: In Setup:
- initialize()
- setWheelCircumference_m(float wheelCircumference_m_);
- setStdDevModel(float stdDev);
- setStdDevSensor(float stdDev);
- setSinusoidBounds(float bound);
When turning on motor to turn wheel
- setWheelPeriod_s(float period_s);
- setWheelDirection(direction wheelDirection_);
- setMaxMinSensorValues(float min_, float max_);
- initKalmanPrediction(float predictionX, float predictionY);
Then can turn on motors after doing above steps and entering the loop Then in loop:
- setSensorReadTimeDelta(float timeDelta_s);
- setSensorReadings(float sensorReading_mpss);
- runFilter();
- get Kalman Results using getPredictionValueX() and getPredictionValueY()
- get distance traveled using getDistanceTaveled_m()