1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

OP-1216 removed "reverseThrottle" systemsetting and have reversethrottle implicitly allowed for REVERSABLEMOTOR type outputs

This commit is contained in:
Corvus Corax 2014-03-09 10:00:58 +01:00
parent e31dcd7950
commit 0ece1a1fb3
2 changed files with 7 additions and 24 deletions

View File

@ -170,7 +170,6 @@ static void actuatorTask(__attribute__((unused)) void *parameters)
MixerStatusData mixerStatus; MixerStatusData mixerStatus;
FlightStatusData flightStatus; FlightStatusData flightStatus;
SystemSettingsThrustControlOptions thrustType; SystemSettingsThrustControlOptions thrustType;
SystemSettingsAllowReverseThrottleOptions allowReverseThrottle;
float throttleDesired; float throttleDesired;
float collectiveDesired; float collectiveDesired;
@ -228,7 +227,6 @@ static void actuatorTask(__attribute__((unused)) void *parameters)
ActuatorDesiredGet(&desired); ActuatorDesiredGet(&desired);
ActuatorCommandGet(&command); ActuatorCommandGet(&command);
SystemSettingsThrustControlGet(&thrustType); SystemSettingsThrustControlGet(&thrustType);
SystemSettingsAllowReverseThrottleGet(&allowReverseThrottle);
// read in throttle and collective -demultiplex thrust // read in throttle and collective -demultiplex thrust
switch (thrustType) { switch (thrustType) {
@ -248,12 +246,10 @@ static void actuatorTask(__attribute__((unused)) void *parameters)
bool armed = flightStatus.Armed == FLIGHTSTATUS_ARMED_ARMED; bool armed = flightStatus.Armed == FLIGHTSTATUS_ARMED_ARMED;
// safety settings // safety settings
if (allowReverseThrottle == SYSTEMSETTINGS_ALLOWREVERSETHROTTLE_FALSE && (throttleDesired < 0 || !armed)) { if (!armed) {
throttleDesired = -1;
} else if (allowReverseThrottle == SYSTEMSETTINGS_ALLOWREVERSETHROTTLE_TRUE && !armed) {
throttleDesired = 0; throttleDesired = 0;
} }
if (throttleDesired < 0 || !armed) { if (throttleDesired <= 0.00f || !armed) {
// force set all other controls to zero if throttle is cut (previously set in Stabilization) // force set all other controls to zero if throttle is cut (previously set in Stabilization)
if (actuatorSettings.LowThrottleZeroAxis.Roll == ACTUATORSETTINGS_LOWTHROTTLEZEROAXIS_TRUE) { if (actuatorSettings.LowThrottleZeroAxis.Roll == ACTUATORSETTINGS_LOWTHROTTLEZEROAXIS_TRUE) {
desired.Roll = 0; desired.Roll = 0;
@ -283,14 +279,9 @@ static void actuatorTask(__attribute__((unused)) void *parameters)
AlarmsClear(SYSTEMALARMS_ALARM_ACTUATOR); AlarmsClear(SYSTEMALARMS_ALARM_ACTUATOR);
bool activeThrottle; bool activeThrottle = (throttleDesired < 0.00f || throttleDesired > 0.00f);
// note: throttle==0 is an inactive throttle and turns motors off bool positiveThrottle = (throttleDesired > 0.00f);
if (allowReverseThrottle == SYSTEMSETTINGS_ALLOWREVERSETHROTTLE_TRUE) { bool spinWhileArmed = actuatorSettings.MotorsSpinWhileArmed == ACTUATORSETTINGS_MOTORSSPINWHILEARMED_TRUE;
activeThrottle = throttleDesired > 0.00f || throttleDesired < 0.00f;
} else {
activeThrottle = throttleDesired > 0.00f;
}
bool spinWhileArmed = actuatorSettings.MotorsSpinWhileArmed == ACTUATORSETTINGS_MOTORSSPINWHILEARMED_TRUE;
float curve1 = MixerCurve(throttleDesired, mixerSettings.ThrottleCurve1, MIXERSETTINGS_THROTTLECURVE1_NUMELEM); float curve1 = MixerCurve(throttleDesired, mixerSettings.ThrottleCurve1, MIXERSETTINGS_THROTTLECURVE1_NUMELEM);
@ -354,13 +345,13 @@ static void actuatorTask(__attribute__((unused)) void *parameters)
if (mixers[ct].type == MIXERSETTINGS_MIXER1TYPE_MOTOR) { if (mixers[ct].type == MIXERSETTINGS_MIXER1TYPE_MOTOR) {
// If not armed or motors aren't meant to spin all the time // If not armed or motors aren't meant to spin all the time
if (!armed || if (!armed ||
(!spinWhileArmed && !activeThrottle)) { (!spinWhileArmed && !positiveThrottle)) {
filterAccumulator[ct] = 0; filterAccumulator[ct] = 0;
lastResult[ct] = 0; lastResult[ct] = 0;
status[ct] = -1; // force min throttle status[ct] = -1; // force min throttle
} }
// If armed meant to keep spinning, // If armed meant to keep spinning,
else if ((spinWhileArmed && !activeThrottle) || else if ((spinWhileArmed && !positiveThrottle) ||
(status[ct] < 0)) { (status[ct] < 0)) {
status[ct] = 0; status[ct] = 0;
} }

View File

@ -15,14 +15,6 @@
use "collective" and use the collective channel to use "collective" and use the collective channel to
control the brakes for optimum autopilot performance) control the brakes for optimum autopilot performance)
--> -->
<field name="AllowReverseThrottle" units="bool" type="enum" elements="1" options="false,true" defaultvalue="false" />
<!-- on quadcopters and most other craft, throttle can only be
positive. Negative throttles are treated as an emergency
cutoff and will set the actuator to the minimum configured
value. On a ground vehicle or other craft that can spin
propellers 'both ways' however this minimum value would be
'full reverese' and it's 'save' value is at neutral.
Therefore no "throttle clamping" takes place! -->
<field name="GUIConfigData" units="bits" type="uint32" elements="4" defaultvalue="0"/> <field name="GUIConfigData" units="bits" type="uint32" elements="4" defaultvalue="0"/>
<field name="AirSpeedMax" units="m/s" type="float" elements="1" defaultvalue="30"/> <field name="AirSpeedMax" units="m/s" type="float" elements="1" defaultvalue="30"/>
<!-- Vne, i.e. maximum airspeed the airframe can handle - used by autopilot, actuator compensation. as well as possibly by INS for plausibility checks --> <!-- Vne, i.e. maximum airspeed the airframe can handle - used by autopilot, actuator compensation. as well as possibly by INS for plausibility checks -->