Altitude Hold initial bank angle safety changes


Altitude Hold uses a calculated hover thrust that it maintains. The code documents that you should hover before engaging AH so AH can get a starting hover throttle. It appears that AH gets the throttle setting in use at the time AH is engaged, but gets if from the wrong place.

AH also uses CruiseControl for automatic bank angle throttle management.

If you are flying say Rate mode with manual throttle and a normal hover throttle stick position or actually anything above throttle cutoff, and you bank over to high bank angle like 80 degrees and engage AH there you will have a problem. AH will get the high throttle setting necessary for the high bank angle and use it, without reducing it even after the vehicle is level again. It remains stuck at full throttle. This is repeatable on the bench (so no altitude change) but also happens in flight. In my case it had climbed over a hundred meters in the few seconds it took me to get my transmitter back in my chopped up hand (my fault but getting stuck on full throttle was unexpected) and go back to Attitude/ManualThrust flight mode.

This should be recreatable on the ground ( take props off ! ) in Rate mode Manual thrust (so you aren't even getting a bank angle boost) by leaning the quad to 80 degrees, setting throttle just high enough to start the motors and switching to AH.

This should be recreatable in flight by flying Attitude (max angle = 80 or so) with Manual Thrust mode. Bank to 80 degrees and switch to Attitude/AH. Relax back to neutral bank angle and see it continue to climb at full throttle. Switch back to Attitude/Manual to recover.

It also appears that AH does not obey the CruiseControlMaxPowerFactor (default 3x) so it will even take a 3% throttle to 100% instead of 9%.

Known Fixes to consider:

  • AH MUST grab the manualcontrol thrust stick value before the bank angle compensation has been multiplied in, not after it if the current code is to remain.

  • Examine AltitudeVario for similar issues.

  • Should AH simply grab AltitudeHoldSettings.ThrustLimits.Neutral and use that for initial throttle? Could have invalid (-1) values for AltitudeHoldSettings.ThrustLimits and require the user to set them. AutoTune could populate AltitudeHoldSettings.ThrustLimits.Neutral

  • VtolPathFollowerSettings also has some vertical thrust limits and code

  • AH could obey MaxPowerFactor








Fix versions