Browse Source

AP_NavEKF3: fixed bug in EKF lane selection

this fixes an issue in selecting the best lane to change to when we
have 3 or more EKF cores. The bug is that if the current lane is
unhealthy it would always choose the last healthy lane instead of
choosing the lane with the lowest score
mission-4.1.18
Andrew Tridgell 6 years ago
parent
commit
e4f6ffe719
  1. 2
      libraries/AP_NavEKF3/AP_NavEKF3.cpp

2
libraries/AP_NavEKF3/AP_NavEKF3.cpp

@ -777,7 +777,7 @@ void NavEKF3::UpdateFilter(void) @@ -777,7 +777,7 @@ void NavEKF3::UpdateFilter(void)
// If the primary core is still healthy,then switching is optional and will only be done if
// a core with a significantly lower error score can be found
float altErrorScore = core[coreIndex].errorScore();
if (altCoreAvailable && (!core[primary].healthy() || altErrorScore < lowestErrorScore)) {
if (altCoreAvailable && (!core[newPrimaryIndex].healthy() || altErrorScore < lowestErrorScore)) {
newPrimaryIndex = coreIndex;
lowestErrorScore = altErrorScore;
}

Loading…
Cancel
Save