1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-15 07:29:15 +01:00

Fix bug in the integral for altitude hold where it was accumulating wrong variable.

This commit is contained in:
James Cotton 2012-02-21 00:37:52 -06:00
parent 900780e10c
commit 7b548eaa54

View File

@ -332,7 +332,7 @@ static void altitudeHoldTask(void *parameters)
error = (starting_altitude + altitudeHoldDesired.Altitude) - altHold.Altitude;
// 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
if((thisTime - lastUpdateTime) < 20)