1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-18 08:54:15 +01:00

Flight: Safety feature for VTOL. Don't enable motor until throttle brought above .5 then below or to zero.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1604 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
peabody124 2010-09-12 22:18:21 +00:00 committed by peabody124
parent 76971a807c
commit 47a7b8548b

View File

@ -63,6 +63,7 @@ static void setFailsafe();
static float bound(float val, float min, float max);
static uint8_t vtolEnabled = 0;
/**
* @brief Module initialization
* @return 0
@ -97,6 +98,8 @@ static void actuatorTask(void* parameters)
ActuatorSettingsGet(&settings);
PIOS_Servo_SetHz(settings.ChannelUpdateFreq[0], settings.ChannelUpdateFreq[1]);
vtolEnabled = 0; // a flag that must be set by moving throttle up and down again
// Go to the neutral (failsafe) values until an ActuatorDesired update is received
setFailsafe();
@ -291,10 +294,19 @@ static int32_t mixerVTOL(const ActuatorSettingsData* settings, const ActuatorDes
VTOLSettingsGet(&vtolSettings);
VTOLStatusGet(&vtolStatus);
// Simple logic to require throttle past .5 and then brought back before enabling motors.
// This possibly should be used for other mixers.
if ((vtolEnabled == 0) && (desired->Throttle > .5))
vtolEnabled = 1;
if ((vtolEnabled == 1) && (desired->Throttle <= 0))
vtolEnabled = 2;
const int vtolMin = -1;
int vtolMax = 1;
if(desired->Throttle < 0)
if(desired->Throttle < 0 || vtolEnabled < 2)
vtolMax = -1;
else
vtolMax = 1;
if(((settings->VTOLMotorN != ACTUATORSETTINGS_VTOLMOTORN_NONE) +
(settings->VTOLMotorNE != ACTUATORSETTINGS_VTOLMOTORS_NONE) +