ardupilot
ardupilot copied to clipboard
Plane: Refactor altitude target into altitudePlanner library.
This is an attempt to split off a fair amount of the plane altitude handling into a library. The behaviour is intended to be identical, if there are any cases of concern I'd like to add them as auto-tests.
- Moves the global state associated with the target altitude, leaving only those associated with fly-by-wire altitude control
- Moves GLIDE_SLOPE_MIN and GLIDE_SLOPE_THR into AP_Vehicle to make them accessible from the library.
- Cleans up somewhat how AP_Landing interacts with altitude planning, by allowing it to speak to the new library rather than passing in function handles.
- Alters the altitude functions in-place for best chance of review. In some paces I have had to pass in flags to avoid explicitly checking flight mode or flight stage. Of course these functions would be moved to AP_AltitudePlanner.cpp at a later stage.
The motivation is to ultimately improve altitude control by better integrating the TECS, landing and altitude planning code, especially during landing.
In future I want to make the interfaces more explicit and investigating unifying set_target_altitude_current and set_target_altitude_location (for instance).