From 1b16f3575a9493809e903f9823001520b4ad28b3 Mon Sep 17 00:00:00 2001 From: Nic Date: Tue, 17 May 2016 21:07:04 -0700 Subject: [PATCH] added ev_pos flag check to valid_lpos, disable fake gps when ev_pos is valid --- EKF/ekf.cpp | 2 +- EKF/estimator_interface.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/EKF/ekf.cpp b/EKF/ekf.cpp index e15cb646a5..e6109b0b50 100644 --- a/EKF/ekf.cpp +++ b/EKF/ekf.cpp @@ -332,7 +332,7 @@ bool Ekf::update() // if we aren't doing any aiding, fake GPS measurements at the last known position to constrain drift // Coincide fake measurements with baro data for efficiency with a minimum fusion rate of 5Hz - if (!_control_status.flags.gps && !_control_status.flags.opt_flow + if (!_control_status.flags.gps && !_control_status.flags.opt_flow && !_control_status.flags.ev_pos && ((_time_last_imu - _time_last_fake_gps > 2e5) || _fuse_height)) { _fuse_pos = true; _time_last_fake_gps = _time_last_imu; diff --git a/EKF/estimator_interface.cpp b/EKF/estimator_interface.cpp index 7ebd465abe..81fb4d13cc 100644 --- a/EKF/estimator_interface.cpp +++ b/EKF/estimator_interface.cpp @@ -393,5 +393,7 @@ void EstimatorInterface::unallocate_buffers() bool EstimatorInterface::local_position_is_valid() { // return true if the position estimate is valid - return (((_time_last_imu - _time_last_optflow) < 5e6) && _control_status.flags.opt_flow) || global_position_is_valid(); + return (((_time_last_imu - _time_last_optflow) < 5e6) && _control_status.flags.opt_flow) || + (((_time_last_imu - _time_last_ext_vision) < 5e6) && _control_status.flags.ev_pos) || + global_position_is_valid(); }