From 1a2da887abd27e3309d4917f37f98d0813c65169 Mon Sep 17 00:00:00 2001 From: Paul Riseborough Date: Wed, 9 Mar 2016 09:29:15 +1100 Subject: [PATCH] EKF: Fix bug in calculation of terrain estimator Kalman gain --- EKF/terrain_estimator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EKF/terrain_estimator.cpp b/EKF/terrain_estimator.cpp index f9caa3e03d..dd6fd9a206 100644 --- a/EKF/terrain_estimator.cpp +++ b/EKF/terrain_estimator.cpp @@ -104,7 +104,7 @@ void Ekf::fuseHagl() if (test_ratio <= 1.0f) { // calculate the Kalman gain - float gain = obs_variance / _hagl_innov_var; + float gain = _terrain_var / _hagl_innov_var; // correct the state _terrain_vpos -= gain * _hagl_innov; // correct the variance