1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

fixed signs in control loop

This commit is contained in:
Corvus Corax 2013-12-08 14:00:18 +01:00
parent 84af4b7651
commit 95d52c6b08

View File

@ -149,10 +149,10 @@ static void altitudeHoldTask(void)
VelocityStateDownGet(&velocityStateDown);
// altitude control loop
altitudeHoldStatus.VelocityDesired = altitudeHoldSettings.AltitudeP * (positionStateDown - altitudeHoldDesired.Altitude) + altitudeHoldDesired.Velocity;
altitudeHoldStatus.VelocityDesired = altitudeHoldSettings.AltitudeP * (altitudeHoldDesired.Altitude - positionStateDown) + altitudeHoldDesired.Velocity;
// velocity control loop
altitudeHoldStatus.AccelerationDesired = altitudeHoldSettings.VelocityP * (velocityStateDown - altitudeHoldStatus.VelocityDesired) - 9.81f;
altitudeHoldStatus.AccelerationDesired = altitudeHoldSettings.VelocityP * (altitudeHoldStatus.VelocityDesired - velocityStateDown) - 9.81f;
altitudeHoldStatus.AccelerationFiltered = accelStateDown;