EKF: do not fuse multiple times the same height (#767)

* EKF: do not fuse multiple times the same height

The _fuse_height flag was never set to zero, hence the fusion was called
at each iteration, even if no new data is available.
The effects were: high CPU usage and virtually less measurement noise
due to multiple fusion of the same sample

Also remve unused variables
This commit is contained in:
Mathieu Bresciani
2020-03-04 10:31:22 +01:00
committed by GitHub
parent b4ecfb7723
commit 230c865fa9
5 changed files with 368 additions and 377 deletions
+1 -1
View File
@@ -139,7 +139,7 @@ bool Ekf::fuseVerticalPosition(const Vector3f &innov, const Vector2f &innov_gate
// Helper function that fuses a single velocity or position measurement
void Ekf::fuseVelPosHeight(const float innov, const float innov_var, const int obs_index) {
float Kfusion[24] = {}; // Kalman gain vector for any single observation - sequential fusion is used.
float Kfusion[24]; // Kalman gain vector for any single observation - sequential fusion is used.
const unsigned state_index = obs_index + 4; // we start with vx and this is the 4. state
// calculate kalman gain K = PHS, where S = 1/innovation variance