mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-16 08:29:15 +01:00
Fix bug in the integral for altitude hold where it was accumulating wrong variable.
This commit is contained in:
parent
900780e10c
commit
7b548eaa54
@ -332,7 +332,7 @@ static void altitudeHoldTask(void *parameters)
|
|||||||
error = (starting_altitude + altitudeHoldDesired.Altitude) - altHold.Altitude;
|
error = (starting_altitude + altitudeHoldDesired.Altitude) - altHold.Altitude;
|
||||||
|
|
||||||
// Compute integral off altitude error
|
// Compute integral off altitude error
|
||||||
throttleIntegral += ((starting_altitude + altitudeHoldDesired.Altitude) - altHold.Velocity) * altitudeHoldSettings.Ki * dT;
|
throttleIntegral += error * altitudeHoldSettings.Ki * dT;
|
||||||
|
|
||||||
// Only update stabilizationDesired less frequently
|
// Only update stabilizationDesired less frequently
|
||||||
if((thisTime - lastUpdateTime) < 20)
|
if((thisTime - lastUpdateTime) < 20)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user