mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 06:53:35 +08:00
EKF: Improve detection of indoor flight condition
This commit is contained in:
committed by
Lorenz Meier
parent
565f99254c
commit
ea9e8246ed
+3
-3
@@ -1400,13 +1400,13 @@ void Ekf::controlMagFusion()
|
||||
_control_status.flags.mag_dec = false;
|
||||
}
|
||||
|
||||
// If optical flow is the only aiding source and GPS checks are failing, then assume that we are operating
|
||||
// If optical flow is enabled there is no other aiding active and GPS checks are failing, then assume that we are operating
|
||||
// indoors and the magnetometer is unreliable. Becasue the optical flow sensor is body fixed, absolute yaw
|
||||
// wrt North is not required for navigation and it is safer not to use the magnetometer.
|
||||
if ((_control_status.flags.opt_flow || _mag_use_inhibit)
|
||||
if (((_params.fusion_mode & MASK_USE_OF) || _mag_use_inhibit)
|
||||
&& !_control_status.flags.gps
|
||||
&& !_control_status.flags.ev_pos
|
||||
&& (_time_last_imu - _last_gps_pass_us > (uint64_t)5e6)) {
|
||||
&& ((_time_last_imu - _last_gps_pass_us > (uint64_t)5e6) || !(_params.fusion_mode & MASK_USE_GPS))) {
|
||||
_mag_use_inhibit = true;
|
||||
} else {
|
||||
_mag_use_inhibit = false;
|
||||
|
||||
Reference in New Issue
Block a user