Improve function of MIN_ALT fence #25811
Closed
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.
FENCE_ENABLE enables or disables fences , but on boot, floor is disabled, blocking the MIN_ALT fence operation unless an overt enable occurs, ie switch or GCS command...FENCE_ENABLE itself does not impact floor state.
This PR: Enables the floor (if not enabled) once MIN_ALT is achieved. Use a flag to record the achievement to prevent further enables. This flag is reset to allow re-enables after landings disable the floor: on disarm or when below 3m(or whatever) to home alt which will allows most vehicle landings to takeoff again without disarm and the floor re-instated.
The reset algorithm for the flag which allows floor to be autoenabled again, was chosen since "landed" is not state in fixed wing and was minimal code. If the landing does not reset the flag, its no worse than present behavior and requires an overt fence enable or disarm to allow another takeoff. I will work on a separate PR to create a "landed" state call for both plane and copter that this library can use to replace the height above home reset term.
A lot of Plane SITL testing has been done, but more is will be done for Copter...
I will fix commit message a bit later