1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

LP-549 Disable Iterm zeroing at low throttle when ASWA is enabled.

LP-549 Enable ASWA only after initial throttle threshold has been reached to allow Iterm to be zeroed with zero throttle while on ground.
This commit is contained in:
Vladimir Zidar 2017-09-08 09:49:20 +02:00
parent e3a658d153
commit 28ad66502a
3 changed files with 9 additions and 3 deletions

View File

@ -66,6 +66,7 @@
#define ASSISTEDCONTROL_BRAKETHRUST_DEADBAND_FACTOR_HI 1.04f
#define ALWAYSTABILIZEACCESSORY_THRESHOLD 0.05f
#define ALWAYSTABILIZETHROTTLE_THRESHOLD 0.2f
// defined handlers
@ -499,7 +500,7 @@ static void manualControlTask(void)
if (alwaysStabilizedSwitch) {
if (acc.AccessoryVal <= -ALWAYSTABILIZEACCESSORY_THRESHOLD) {
newAlwaysStabilized = FLIGHTSTATUS_ALWAYSSTABILIZEWHENARMED_FALSE;
} else if (acc.AccessoryVal >= ALWAYSTABILIZEACCESSORY_THRESHOLD) {
} else if ((acc.AccessoryVal >= ALWAYSTABILIZEACCESSORY_THRESHOLD) && (cmd.Thrust >= ALWAYSTABILIZETHROTTLE_THRESHOLD)) { // && Thrust (or Throttle?) above threshold
newAlwaysStabilized = FLIGHTSTATUS_ALWAYSSTABILIZEWHENARMED_TRUE;
}
} else {

View File

@ -449,10 +449,15 @@ static void stabilizationInnerloopTask()
{
FlightStatusArmedOptions armed;
FlightStatusArmedGet(&armed);
FlightStatusAlwaysStabilizeWhenArmedOptions alwaysStabilizeWhenArmed;
FlightStatusAlwaysStabilizeWhenArmedGet(&alwaysStabilizeWhenArmed);
float throttleDesired;
ManualControlCommandThrottleGet(&throttleDesired);
if (armed != FLIGHTSTATUS_ARMED_ARMED ||
((stabSettings.settings.LowThrottleZeroIntegral == STABILIZATIONSETTINGS_LOWTHROTTLEZEROINTEGRAL_TRUE) && throttleDesired < 0)) {
((stabSettings.settings.LowThrottleZeroIntegral == STABILIZATIONSETTINGS_LOWTHROTTLEZEROINTEGRAL_TRUE) &&
(throttleDesired < 0) &&
(alwaysStabilizeWhenArmed != FLIGHTSTATUS_ALWAYSSTABILIZEWHENARMED_TRUE))) {
// Force all axes to reinitialize when engaged
for (t = 0; t < AXES; t++) {
previous_mode[t] = 255;

View File

@ -82,7 +82,7 @@
options="Disabled,Accessory 0,Accessory 1,Accessory 2,Accessory 3"
defaultvalue="Disabled"
description="For Multirotors. Always stabilize no matter the throttle setting when vehicle is armed. Does not work when vehicle is set to Always Armed."/>
<field name="ArmedTimeout" units="ms" type="uint16" elements="1" defaultvalue="30000"/>
<field name="ArmingSequenceTime" units="ms" type="uint16" elements="1" defaultvalue="1000"/>
<field name="DisarmingSequenceTime" units="ms" type="uint16" elements="1" defaultvalue="1000"/>