EKF: Improve GPS blending; Allow >2 GPSs #14355
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe problem solved by this pull request
The GPS blending in EFK2 is hard-coded to 2 GPS receivers, and the failover logic when one GPS fails / loses fix is a bit lacking.
Describe your solution
Made the GPS blending logic within ekf2_main more generic; can now (by changing 2 lines of code) handle blending of an arbitrary number of GPS units. Right now, it's up to 3 GPS units. I also updated the logic behind the selection of a single fallback GPS (in the case that blending has failed) to correctly choose the "best" GPS that is available / hasn't timed out. I welcome feedback on the method I came up with though; I may have missed some edge cases.
Test data / coverage
I have logs from testing somewhere... I'll retest and upload logs soon.
I used a Here2, a Here+, and a Zubax (at the same time) to test that the data was being blended as expected, and that when one GPS dropped out the switch to using other units happened seamlessly.
Side note, #14345 allows you to use the extra compasses and barometers when you have extra UAVCAN GPSs connected 馃槈