From f5fd38aef2d2c72f437f55561e32fb4252fced59 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 2 Jul 2019 16:17:46 +1000 Subject: [PATCH] AP_NavEKF2: set terrainState to zero on height datum reset --- libraries/AP_NavEKF2/AP_NavEKF2_PosVelFusion.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/AP_NavEKF2/AP_NavEKF2_PosVelFusion.cpp b/libraries/AP_NavEKF2/AP_NavEKF2_PosVelFusion.cpp index dfdb485245..81b1472cc5 100644 --- a/libraries/AP_NavEKF2/AP_NavEKF2_PosVelFusion.cpp +++ b/libraries/AP_NavEKF2/AP_NavEKF2_PosVelFusion.cpp @@ -230,8 +230,9 @@ bool NavEKF2_core::resetHeightDatum(void) } } - // adjust the terrain state - terrainState += oldHgt; + // set the terrain state to zero (on ground). The adjustment for + // frame height will get added in the later constraints + terrainState = 0; return true; }