Navigator: Loiter: always establish new Loiter with center at current position #21775
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
#21702
Vehicle keeps flying towards Loiter waypoint if Hold mode is selected. In the past we within Navigator set the type to POSITION when far away from a Loiter waypoint, and then only to LOITER when really on established loiter, but this distinction is now no longer part of Navigator and the FW position controller handles it.
Solution
When switching into Hold mode establish a Loiter around current position, even if we were before already loitering (eg in Mission mode). This results in the same behavior when switching into Hold/Loiter mode directly (either through RC switch or in the flight mode selection in QGC) or through the "Hold" button in QGC (which sends a DO_REPOSITION with the fields at the current position).
In this screen recording you see the behavior prior and after this PR.
https://github.com/PX4/PX4-Autopilot/assets/26798987/9079b575-77fc-40a2-be54-b3c11816cca3
Changelog Entry
For release notes:
Alternatives
Fix detection on whether we're currently on an established loiter, and in that case don't loiter around current position but keep established loiter. Personally I though prefer to stick to Hold = Loiter around current position always. Imagine being on a huge loiter. If the vehicle then keeps following it it's hardly anymore "Holding position".