EKF3: allow alt from other sources when using ExtNav #15602
Merged
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.
This PR allows the EKF's altitude source to come from another source (baro, rangefinder, etc) when using external nav as the horizontal position source. This is useful especially for users of the T265 which can lose its position and altitude estimate due to high vibration. Because multicopter Z-axis vibrations tend to be particularly high, the camera normally loses its altitude estimate first. Allowing the user to rely on barometer is generally a safer option.
This PR is part of the EKF position source PR: #14803. I've extracted it here to simplify the other PR.
This has been tested in SITL and extensively on a real vehicle. Below is a screen shot of a SITL test in which EK3_ALT_SOURCE = 0 (Baro) but the vicon is enabled. We see that a glitch in the External Nav's Z-axis position has no impact on the EKF's altitude.
![ek3-alt-source-baro](https://user-images.githubusercontent.com/1498098/96443996-71bba400-1248-11eb-9c5b-592443b9215e.png)
This is the same test again but with EK3_ALT_SOURCE = 4 (ExtNav) and the EKF's altitude is affected by a glitch in the External Nav's Z-axis position.
![ek3-alt-source-extnav](https://user-images.githubusercontent.com/1498098/96444041-7e3ffc80-1248-11eb-92c6-c6eaf1b0c598.png)
The ExtNav altitude can also be used with GPS (or other horizontal position source). I tested this in SITL as well and it worked as expected.