ExtendedKalmanFilter.h 716 B

123456789101112131415161718192021222324252627
  1. /*
  2. Extended Kalman Filter class by Sam Tabor, 2013.
  3. * http://diydrones.com/forum/topics/autonomous-soaring
  4. * Set up for identifying thermals of Gaussian form, but could be adapted to other
  5. * purposes by adapting the equations for the jacobians.
  6. */
  7. #pragma once
  8. #include <AP_Math/matrixN.h>
  9. class ExtendedKalmanFilter {
  10. public:
  11. ExtendedKalmanFilter(void) {}
  12. static constexpr const uint8_t N = 4;
  13. VectorN<float,N> X;
  14. MatrixN<float,N> P;
  15. MatrixN<float,N> Q;
  16. float R;
  17. void reset(const VectorN<float,N> &x, const MatrixN<float,N> &p, const MatrixN<float,N> q, float r);
  18. void update(float z, float Vx, float Vy);
  19. private:
  20. float measurementpredandjacobian(VectorN<float,N> &A);
  21. };