ekf2: Fix description of EKF2_HDG_GATE #21708
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.
Solved Problem
The description of EKF2_HDG_GATE made me assume this parameter was irrelevant for a vehicle that doesn't use a magnetometer:
I'm working on a multicopter with external odometry input (via mavlink ODOMETRY type VISION). I want the external odometry system's heading to always be trusted, so I had set EKF2_HDG_GATE very high. Later, having forgotten about the original reason for setting EKF2_HDG_GATE, I found that the docs for this parameter say "Gate size for magnetic heading fusion". Since I do not use a magnetometer, this made me think I'd set this parameter by mistake, so I reset it to the default value. When flying, it became clear that it does indeed also affect yaw estimation with only external vision/odometry yaw, but the parameter description is a bit misleading.
Solution
The simplest fix is to just not mention "magnetometer" in the description of EKF2_HDG_GATE.
Changelog Entry
For release notes:
Alternatives
Not sure, maybe separate parameters for magnetometer heading fusion and other types of heading fusion, but that seems overkill.
Test coverage
N/A
Context
I verified that EKF2_HDG_GATE does affect my system (no magnetometer, using external odometry), by
setExtVisionData
_ext_vision_buffer
Ekf::update
runsEkf::controlFusionModes
Ekf::controlExternalVisionFusion
Ekf::controlEvYawFusion
Ekf::fuseYaw(3 args)
Ekf::fuseYaw(4 args)
_params.heading_innov_gate
which is EKF2_HDG_GATEEkf::updateGpsYaw
)