mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-30 15:52:12 +01:00
OP-163 Flight/Guidance: Take current position as desired position
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2111 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
6ebc8ccd57
commit
54aa09ce27
@ -91,6 +91,7 @@ static float eastIntegral = 0;
|
||||
static float eastErrorLast = 0;
|
||||
static float downIntegral = 0;
|
||||
static float downErrorLast = 0;
|
||||
static uint8_t positionHoldLast = 0;
|
||||
|
||||
/**
|
||||
* Module thread, should not return.
|
||||
@ -115,6 +116,18 @@ static void guidanceTask(void *parameters)
|
||||
(systemSettings.AirframeType == SYSTEMSETTINGS_AIRFRAMETYPE_QUADP) ||
|
||||
(systemSettings.AirframeType == SYSTEMSETTINGS_AIRFRAMETYPE_QUADX)))
|
||||
{
|
||||
if(positionHoldLast == 0) {
|
||||
/* When enter position hold mode save current position */
|
||||
PositionDesiredData positionDesired;
|
||||
PositionActualData positionActual;
|
||||
PositionDesiredGet(&positionDesired);
|
||||
PositionActualGet(&positionActual);
|
||||
positionDesired.North = positionActual.North;
|
||||
positionDesired.East = positionActual.East;
|
||||
PositionDesiredSet(&positionDesired);
|
||||
positionHoldLast = 1;
|
||||
}
|
||||
|
||||
if(guidanceSettings.GuidanceMode == GUIDANCESETTINGS_GUIDANCEMODE_POSITION_PID) {
|
||||
positionPIDcontrol();
|
||||
} else {
|
||||
@ -133,6 +146,7 @@ static void guidanceTask(void *parameters)
|
||||
eastErrorLast = 0;
|
||||
downIntegral = 0;
|
||||
downErrorLast = 0;
|
||||
positionHoldLast = 0;
|
||||
}
|
||||
vTaskDelayUntil(&lastSysTime, guidanceSettings.VelUpdatePeriod / portTICK_RATE_MS);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user