Skip to content

Commit 28ad665

Browse files
committed
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.
1 parent e3a658d commit 28ad665

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

flight/modules/ManualControl/manualcontrol.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
#define ASSISTEDCONTROL_BRAKETHRUST_DEADBAND_FACTOR_HI 1.04f
6767

6868
#define ALWAYSTABILIZEACCESSORY_THRESHOLD 0.05f
69+
#define ALWAYSTABILIZETHROTTLE_THRESHOLD 0.2f
6970

7071
// defined handlers
7172

@@ -499,7 +500,7 @@ static void manualControlTask(void)
499500
if (alwaysStabilizedSwitch) {
500501
if (acc.AccessoryVal <= -ALWAYSTABILIZEACCESSORY_THRESHOLD) {
501502
newAlwaysStabilized = FLIGHTSTATUS_ALWAYSSTABILIZEWHENARMED_FALSE;
502-
} else if (acc.AccessoryVal >= ALWAYSTABILIZEACCESSORY_THRESHOLD) {
503+
} else if ((acc.AccessoryVal >= ALWAYSTABILIZEACCESSORY_THRESHOLD) && (cmd.Thrust >= ALWAYSTABILIZETHROTTLE_THRESHOLD)) { // && Thrust (or Throttle?) above threshold
503504
newAlwaysStabilized = FLIGHTSTATUS_ALWAYSSTABILIZEWHENARMED_TRUE;
504505
}
505506
} else {

flight/modules/Stabilization/innerloop.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,10 +449,15 @@ static void stabilizationInnerloopTask()
449449
{
450450
FlightStatusArmedOptions armed;
451451
FlightStatusArmedGet(&armed);
452+
FlightStatusAlwaysStabilizeWhenArmedOptions alwaysStabilizeWhenArmed;
453+
FlightStatusAlwaysStabilizeWhenArmedGet(&alwaysStabilizeWhenArmed);
454+
452455
float throttleDesired;
453456
ManualControlCommandThrottleGet(&throttleDesired);
454457
if (armed != FLIGHTSTATUS_ARMED_ARMED ||
455-
((stabSettings.settings.LowThrottleZeroIntegral == STABILIZATIONSETTINGS_LOWTHROTTLEZEROINTEGRAL_TRUE) && throttleDesired < 0)) {
458+
((stabSettings.settings.LowThrottleZeroIntegral == STABILIZATIONSETTINGS_LOWTHROTTLEZEROINTEGRAL_TRUE) &&
459+
(throttleDesired < 0) &&
460+
(alwaysStabilizeWhenArmed != FLIGHTSTATUS_ALWAYSSTABILIZEWHENARMED_TRUE))) {
456461
// Force all axes to reinitialize when engaged
457462
for (t = 0; t < AXES; t++) {
458463
previous_mode[t] = 255;

shared/uavobjectdefinition/flightmodesettings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
options="Disabled,Accessory 0,Accessory 1,Accessory 2,Accessory 3"
8383
defaultvalue="Disabled"
8484
description="For Multirotors. Always stabilize no matter the throttle setting when vehicle is armed. Does not work when vehicle is set to Always Armed."/>
85-
85+
8686
<field name="ArmedTimeout" units="ms" type="uint16" elements="1" defaultvalue="30000"/>
8787
<field name="ArmingSequenceTime" units="ms" type="uint16" elements="1" defaultvalue="1000"/>
8888
<field name="DisarmingSequenceTime" units="ms" type="uint16" elements="1" defaultvalue="1000"/>

0 commit comments

Comments
 (0)