FW Position Controller: navigateWaypoint(): fix corner case of vehicle not turning back to waypoint #21635
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
Fixes #21327
Vehicle fly away when the currently active WP is the current vehicle position, relative to the line from previous to next waypoint. That happens e.g. when the vehicle loitered to achieve altitude and is then "passed" the current WP when the altitude is accepted.
Solution
There was already logic in place that handled the case of the vehicle being behind the previous WP, but no one where the vehicle is ahead of the current WP. I added that now. The logic changes the guidance from tracking a path between two WP to fly directly to the active WP.
Further, in the second commit I removed the check for "if further than acceptance from waypoint" to apply the special handling. It seems dangerous to me to keep it, what happens if Navigator doesn't accept the WP once within this acceptance radius? In my eyes we should always fly straight to the waypoint instead of doing path following in this case.EDIT: removed this change again.Changelog Entry
For release notes: