PX4-Autopilot
PX4-Autopilot copied to clipboard
EKF2: add validity flags to global pos message
Follow up to https://github.com/PX4/PX4-Autopilot/pull/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.