These concern the TAKEOFF flight stage and address #27147.
* Logging metadata fixes
* Disabled continuous TECS reset during takeoff
* Fixed bug in reached_speed_takeoff calculation
* Limited SPDWEIGHT=2 to only first part of takeoff climb
* _post_TO_hgt_offset set to constant
* Takeoff I-gain now defaults to 0 and is used
* Use at least TRIM_THROTTLE during the climb
* Updated description of TECS_TKOFF_IGAIN with new behaviour
* Forced max throttle while below TKOFF_LVL_ALT
* Added throttle constraints in no-airspeed mode
Additionally, set_min_throttle() has been created, that allows one to
set the minimum TECS throttle for the next update_pitch_throttle() loop.
Additionally, the throttle limits system has been reworked. TECS will
receive external throttle limits from Plane and will always take them
into account and respect them.
When stall prevention is enabled we were scaling from the aircraft's
minimum flight speed. However this is normally already picked as being
above the stall speed, and for a variety of reasons we may want to pin
the aircraft at a higher minimum speed. But if the aircraft was
commanded to fly to close to that minimum speed as soon as it banked for
a pattern it would command a increase in speed to keep it away from
stalling. However if your minimum speed is far from stalling this
increase was incorrect. To make it worse what this actually results in
happening is an aircraft diving for more speed (over 10 m/s on some
aircraft) as well as descending to gain that speed resulting in over 200
foot deviations in altitude control.
the pitch trim variable that was not connected in aparm is needed to
allow tuning of the flight speed using PTCH_TRIM_DEG and
TRIM_THROTTLE.
This was broken in 4.4.x by this PR:
https://github.com/ArduPilot/ardupilot/pull/22191
this fixes a state where we either cannot climb or descend in an
uncontrolled manner in a TECS controlled mode
the conditions under which this happened were:
- _use_synthetic_airspeed_once was true due to quadplane takeoff
- we left _thr_clip_status as MAX from previous use of synthetic airspeed
- then run without airspeed
note that this can also impact users with an airspeed sensor if they
disable it or it fails in flight, particularly during a climb
update_pitch_throttle can be called when update_50hz hasn't run in a very long time, or ever. This requires a main loop rate >50Hz, and for the mode change to occur in the same loop that update_50Hz doesn't run but update_pitch_throttle does.