From b7e589b98aa02f43af0f56e9a117a2e16af2b0c4 Mon Sep 17 00:00:00 2001 From: ChristophTobler Date: Tue, 10 Oct 2017 17:51:56 +0200 Subject: [PATCH] EKF: only fuse optical flow if terrain is valid --- EKF/control.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EKF/control.cpp b/EKF/control.cpp index ac5ca71020..ed195e772a 100644 --- a/EKF/control.cpp +++ b/EKF/control.cpp @@ -383,8 +383,8 @@ void Ekf::controlOpticalFlowFusion() _imu_del_ang_of += _imu_sample_delayed.delta_ang - _state.gyro_bias; _delta_time_of += _imu_sample_delayed.delta_ang_dt; - // fuse the data - if (_control_status.flags.opt_flow) { + // fuse the data if the terrain/distance to bottom is valid + if (_control_status.flags.opt_flow && get_terrain_valid()) { // Update optical flow bias estimates calcOptFlowBias();