EKF2: set baro bias when GNSS is alt ref but fusion is disabled #24093
+45
−3
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.
Solved Problem
Before my global position rework, GNSS altitude was always used to initialise the origin of the local plane frame even when the GNSS altitude is disabled (in EKF2_GPS_CTRL). Some users actually liked this as it gives some sort of quick baro calibration using the GNSS altitude "for free".
Solution
Perform the baro bias correction if
EKF2_HGT_REF
is set to GNSS, even if altitude fusion is disabled inEKF2_GPS_CTRL
.The screenshot below shows a sitl test with
EKF2_HGT_REF
= GNSS andEKF2_GPS_CTRL
= 5 (lat/, on, 3D vel). We can see that the global altitude is correctly set using GNSS altitude.Alternatives
We could also automatically trigger a baro calibration when GNSS data is available (gated by some AUTOCAL parameter, as we do for IMU and mag)
Test coverage
unit test to cover this specific case
general SITL tests