From a1c858534232ca242bbf03b5466686c6d99cc2f9 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 31 Jul 2016 14:01:32 +0200 Subject: [PATCH] EKF2: Report zero as position until local pos is valid --- src/modules/ekf2/ekf2_main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/ekf2/ekf2_main.cpp b/src/modules/ekf2/ekf2_main.cpp index 352de9430f..a613e18b61 100644 --- a/src/modules/ekf2/ekf2_main.cpp +++ b/src/modules/ekf2/ekf2_main.cpp @@ -745,8 +745,8 @@ void Ekf2::task_main() // Position of body origin in local NED frame _ekf.get_position(pos); - lpos.x = pos[0]; - lpos.y = pos[1]; + lpos.x = (_ekf.local_position_is_valid()) ? pos[0] : 0.0f; + lpos.y = (_ekf.local_position_is_valid()) ? pos[1] : 0.0f; lpos.z = pos[2]; // Velocity of body origin in local NED frame (m/s)