mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-27 16:54:15 +01:00
Flight/Stabilization: Dont cap error at maximum stabilization value - that is to scale control throws. Create another variable if we want this.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1676 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
0ea95fbad1
commit
11f2b1a8dc
@ -111,7 +111,7 @@ static void stabilizationTask(void* parameters)
|
||||
AttitudeActualGet(&attitudeActual);
|
||||
|
||||
// Pitch stabilization control loop
|
||||
pitchError = bound(attitudeDesired.Pitch, -stabSettings.PitchMax, stabSettings.PitchMax) - attitudeActual.Pitch;
|
||||
pitchError = attitudeDesired.Pitch - attitudeActual.Pitch;
|
||||
pitchDerivative = (pitchError - pitchErrorLast) / stabSettings.UpdatePeriod;
|
||||
pitchIntegral = bound(pitchIntegral+pitchError*stabSettings.UpdatePeriod, -stabSettings.PitchIntegralLimit, stabSettings.PitchIntegralLimit);
|
||||
actuatorDesired.Pitch = stabSettings.PitchKp*pitchError + stabSettings.PitchKi*pitchIntegral + stabSettings.PitchKd*pitchDerivative;
|
||||
@ -119,7 +119,7 @@ static void stabilizationTask(void* parameters)
|
||||
pitchErrorLast = pitchError;
|
||||
|
||||
// Roll stabilization control loop
|
||||
rollError = bound(attitudeDesired.Roll, -stabSettings.RollMax, stabSettings.RollMax) - attitudeActual.Roll;
|
||||
rollError = attitudeDesired.Roll - attitudeActual.Roll;
|
||||
rollDerivative = (rollError - rollErrorLast) / stabSettings.UpdatePeriod;
|
||||
rollIntegral = bound(rollIntegral+rollError*stabSettings.UpdatePeriod, -stabSettings.RollIntegralLimit, stabSettings.RollIntegralLimit);
|
||||
actuatorDesired.Roll = stabSettings.RollKp*rollError + stabSettings.RollKi*rollIntegral + stabSettings.RollKd*rollDerivative;
|
||||
|
Loading…
x
Reference in New Issue
Block a user