EKF2: add validity flags to global pos message #23787
Open
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.
Follow up to #23776
Solved Problem
This PR introduces validity flags to the global position message as suggested here. Previously, the commander implicitly assumed that if the global position (gpos) was published, it was valid. With these changes, the commander now explicitly relies on the validity state of the global position, ensuring more robust decision-making (in theory one could also check if gpos is getting published and lpos is valid, but this could break at some point).
Instead of checking global position validity within each navigation mode, we leave it to the commander to determine which mode to run based on the best available estimate. While gpos may not always be fully accurate, it still provides the most best estimate. , and additional checks (such as ensuring local position is valid) could lead to unintended behavior in the future.
I'm wondering how we should handle this information in respect to the mavlink interface. Am I right that at the moment when the vehicle flies in stabilized mode any device connected over mavlink does not have any knowledge about the validity of the position estimate without sending a vehicle command to PX4? I'm thinking about the initialization of an external vision pipeline as an example.