mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
Flight/Stabilization: fix for -180/+180 yaw transition which caused glitches in the stab module.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1853 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
dd0d58f64f
commit
eeb5eab177
@ -158,7 +158,11 @@ static void stabilizationTask(void* parameters)
|
||||
( systemSettings.AirframeType == SYSTEMSETTINGS_AIRFRAMETYPE_HELICP))
|
||||
{
|
||||
if(stabSettings.YawMode == STABILIZATIONSETTINGS_YAWMODE_RATE) { // rate stabilization on yaw
|
||||
yawChange = (attitudeActual.Yaw - yawPrevious) / dT;
|
||||
// Avoid a huge (wrong) change if we crossed 0/360
|
||||
yawChange = attitudeActual.Yaw - yawPrevious;
|
||||
if (yawChange>180.0) yawChange -= 360;
|
||||
if (yawChange<-180.0) yawChange += 360;
|
||||
yawChange = yawChange / dT;
|
||||
yawPrevious = attitudeActual.Yaw;
|
||||
yawError = bound(attitudeDesired.Yaw, -stabSettings.YawMax, stabSettings.YawMax) - yawChange;
|
||||
} else { // heading stabilization
|
||||
|
Loading…
x
Reference in New Issue
Block a user