1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

OP-1259 Removed inverted flight pitch and yaw reverse option

This commit is contained in:
Cliff Geerdes 2014-04-29 20:24:49 -04:00
parent 48345f0194
commit 5ee2930181
3 changed files with 376 additions and 342 deletions

View File

@ -105,16 +105,18 @@ struct pid pids[PID_MAX];
int cur_flight_mode = -1;
static float rattitude_mode_transition_stick_position;
static float cruise_control_min_thrust;
static float cruise_control_max_thrust;
static uint8_t cruise_control_max_angle;
static float cruise_control_max_power_factor;
static float cruise_control_power_trim;
static int8_t cruise_control_inverted_power_switch;
static float cruise_control_max_power_factor_angle;
static float cruise_control_half_power_delay;
static float cruise_control_thrust_difference;
static float cruise_control_min_thrust;
static float cruise_control_max_thrust;
static float cruise_control_thrust_difference;
static float cruise_control_max_angle;
static float cruise_control_max_power_factor;
static float cruise_control_power_trim;
static float cruise_control_max_power_factor_angle;
static float cruise_control_half_power_delay;
static uint8_t cruise_control_flight_mode_switch_pos_enable[FLIGHTMODESETTINGS_FLIGHTMODEPOSITION_NUMELEM];
static uint8_t cruise_control_inverted_thrust_reversing;
static uint8_t cruise_control_inverted_power_output;
// Private functions
static void stabilizationTask(void *parameters);
@ -566,23 +568,42 @@ static void stabilizationTask(__attribute__((unused)) void *parameters)
actuatorDesired.UpdateTime = dT * 1000;
actuatorDesired.Thrust = stabDesired.Thrust;
///////////////////////////////////////////////////////////////////////
// Cruise Control
// modify thrust according to 1/cos(bank angle)
// to maintain same altitude with changing bank angle
// but without manually adjusting thrust
// do it here and all the various flight modes (e.g. Altitude Hold) can use it
///////////////////////////////////////////////////////////////////////
// Detect if the flight mode switch has changed. If it has, there
// could be a time gap. E.g. enabled, then disabled for 30 seconds
// then enabled again. Previous_angle will also be invalid because
// of the time spent with Cruise Control off.
static bool previous_time_valid; // initially false
static uint8_t previous_flight_mode_switch_position = 250;
if (flight_mode_switch_position != previous_flight_mode_switch_position) {
previous_flight_mode_switch_position = flight_mode_switch_position;
// Force calculations on this pass (usually every 8th pass),
// but ignore rate calculations (uses time, previous_time, angle,
// previous_angle)
previous_time_valid = false;
}
if (flight_mode_switch_position < FLIGHTMODESETTINGS_FLIGHTMODEPOSITION_NUMELEM
&& cruise_control_flight_mode_switch_pos_enable[flight_mode_switch_position] != (uint8_t)0
&& cruise_control_max_power_factor > 0.0001f) {
static float factor;
static float previous_angle;
static uint32_t previous_time;
static bool previous_time_valid; // initially false
static bool inverted_flight_mode;
static uint8_t calc_count;
static uint8_t previous_flight_mode_switch_position = 250;
uint32_t time;
// For multiple, speedy flips this mainly strives to address the
// fact that (due to thrust delay) thrust didn't average straight
// down, but at an angle. For less speedy flips it acts like it
// used to. It can be turned off by setting power delay to 0.
// It takes significant time for the motors of a multi-copter to
// spin up. It takes significant time for the collective servo of
// a CP heli to move from one end to the other. Both of those are
@ -596,17 +617,22 @@ static void stabilizationTask(__attribute__((unused)) void *parameters)
// before 90 degrees (36 degrees at 360 deg/sec) and it will be
// complete 0.1 seconds after 90 degrees.
// Detect if the flight mode switch has changed. If it has, there
// could be a time gap. E.g. enabled, then disabled for 30 seconds
// then enabled again. Previous_angle will also be invalid because
// of the time spent with Cruise Control off.
if (flight_mode_switch_position != previous_flight_mode_switch_position) {
previous_flight_mode_switch_position = flight_mode_switch_position;
// Force calculations on this pass (usually every 8th pass),
// but ignore rate calculations (uses time, previous_time, angle,
// previous_angle)
previous_time_valid = false;
}
// Note that this code only handles the transition to/from inverted
// thrust. It doesn't handle the case where thrust is changed a
// lot in a small angle range when that range is close to 90 degrees.
// It doesn't handle the small constant "system delay" caused by the
// delay between reading sensors and actuators beginning to respond.
// It also assumes that the pilot is holding the throttle constant;
// when the pilot does change the throttle, the compensation is
// simply recalculated.
// This implementation of future thrust isn't perfect. That would
// probably require an iterative procedure for solving a
// transcendental equation of the form linear(x) = 1/cos(x). It's
// shortcomings generally don't hurt anything and work better than
// without it. It is designed to work perfectly if the pilot is
// using full thrust during flips and it is only activated if 70% or
// greater thrust is used.
time = PIOS_DELAY_GetuS();
@ -631,7 +657,7 @@ static void stabilizationTask(__attribute__((unused)) void *parameters)
if (previous_time_valid) {
float rate;
// Keeping the sign for rate is important. It can be negative.
// rate can be negative.
rate = (angle - previous_angle) / ((float) (time - previous_time) / 1000000.0f);
// Define "within range" to be those transitions that should
@ -640,167 +666,127 @@ static void stabilizationTask(__attribute__((unused)) void *parameters)
// There is only one transition and the high power level for
// it is either:
// = 1/fabsf(cos(angle)) * current thrust
// = max power factor * current thrust
// = full thrust
// You can hit it with angle either increasing or decreasing
// (rate positive or negative).
// 1/fabsf(cos(angle)) * current thrust
// or max power factor * current thrust
// or full thrust
// You can cross the transition with angle either increasing
// or decreasing (rate positive or negative).
// Thrust is never boosted for negative values of
// actuatorDesired.Thrust
// actuatorDesired.Thrust (negative stick values)
//
// When the aircraft is upright, thrust is always boosted
// for positive values of actuatorDesired.Thrust
// . for positive values of actuatorDesired.Thrust
// When the aircraft is inverted, thrust is sometimes
// boosted or reversed (or combinations thereof) or zeroed
// for positive values of actuatorDesired.Thrust
// It depends on the inverted power switch mode.
// . boosted or reversed (or combinations thereof) or zeroed
// . for positive values of actuatorDesired.Thrust
// It depends on the inverted power settings.
// Of course, you can set MaxPowerFactor to 1.0 to
// effectively disable boost.
// Only perform boost calculations for stick values > 0.0
// . effectively disable boost.
if (actuatorDesired.Thrust > 0.0f) {
float thrust;
// to enable the future thrust calculations, make sure
// there is a large enough transition that the result
// will be roughly on vs. off; without that, it can
// exaggerate the length of time the inverted to upright
// transition holds full throttle and reduce the length
// of time for full throttle when going upright to inverted.
if (actuatorDesired.Thrust > 0.95f) {
// change this to 0.7
float thrust;
thrust = CruiseControlFactorToThrust(CruiseControlAngleToFactor(cruise_control_max_angle), actuatorDesired.Thrust);
thrust = CruiseControlFactorToThrust(CruiseControlAngleToFactor(cruise_control_max_angle), actuatorDesired.Thrust);
/*
revisit all the GCS settings
51 <= maxt <= 100
No (0 <= mint <= 49 plus -51 -> -100)
0 <= mint <= 49 or maybe -100 -> 49
1 <= mpf <= 50
50 <= trim <= 200
?? <= maxa <= 255?
0 <= pdc <= 2?
*/
// determine if we are in range of the transition
// determine if we are in range of the transition
// given the thrust at max_angle and actuatorDesired.Thrust
// (typically close to 1.0), change variable 'thrust' to
// be the proportion of the largest thrust change possible
// that occurs when going into inverted mode.
// Example: 'thrust' is 0.8 A quad has min_thrust set
// to 0.05 The difference is 0.75. The largest possible
// difference with this setup is 0.9 - 0.05 = 0.85, so
// the proportion is 0.75/0.85
// That is nearly a full throttle stroke.
switch (cruise_control_inverted_power_switch) {
// reversed and boosted with servo reversing on pitch and yaw too
case -3:
// reversed and boosted
case -2:
// CP heli case, stroke is max to min
thrust = (thrust - CruiseControlFactorToThrust(-CruiseControlAngleToFactor(cruise_control_max_angle), actuatorDesired.Thrust)) / cruise_control_thrust_difference;
break;
// reversed, but not boosted
case -1:
// CP heli case, stroke is max to -stick
thrust = (thrust + CruiseControlLimitThrust(actuatorDesired.Thrust)) / cruise_control_thrust_difference;
break;
// zeroed
case 0:
// normal multi-copter case, stroke is max to zero
// technically max to constant min_thrust
// can be used by CP
thrust = (thrust - CruiseControlLimitThrust(0.0f)) / cruise_control_thrust_difference;
//should this be changed to "max to 0.0f"
// that would mean min is only used for enable
// and that a large min, like 0.5 would make delay inaccurate
//that would allow CP to set min to -0.5 like for mode=1or2?
//do we need two settings? min_inverted_thrust and min_enabled_thrust
//shit, cruise_control_thrust_difference is a problem, maybe remove it
//thrust_difference is always max-min, and now for CP it needs to be max+max here
//maybe not a problem since we don't limit thrust on the negative side any more
//CP: max=1.0, min=-1.0 diff=2.0
//CP: max=1.0, min=-0.1 diff=1.1
//CP: max=1.0, min= 0.0 diff=1.0
//CP: max=1.0, min= 0.1 diff=0.9
//MR: max=0.9, min= 0.1 diff=0.8
/*
as long as the calculated diff is <= diff it is OK
- that means that stroke must always be to min or smaller magnitude
- e.g. min=-0.5 stroke can't go to -1.0
- so -factor*throttle must be limited to -0.5
- but throttle alone can got to -1.0
maybe we need a CP flag
some CP combinations are dangerous?
do not allow thrust to change direction with a small stick change
min=-0.5
Hmmm stroke is max to min, except that we haven't gotten to max yet
- it is really current to min (with current taken from the first time the transition was in range)
*/
break;
// unreversed, unboosted
case 1:
// simply turn off boost, stroke is max to +stick
thrust = (thrust - CruiseControlLimitThrust(actuatorDesired.Thrust)) / cruise_control_thrust_difference;
break;
// unreversed, boosted
case 2:
// CP heli case, no transition, stroke is zero
thrust = 0.0f;
break;
}
// multiply this proportion of max stroke, times the max stroke time, to get this stroke time
// we only want half of this time before the transition (and half after the transition)
thrust *= cruise_control_half_power_delay;
// times angular rate gives angle that this stroke will take to execute
thrust *= fabsf(rate);
// if the transition is within range we use it, else we just use the current calculated thrust
if (cruise_control_max_angle - thrust < angle
&& angle < cruise_control_max_angle + thrust) {
// this may need rework in case max_angle is close to 0 or 180
// wrong, need stuff below for factor? above / below transition and AtoF doesn't do transition
// where is the transition angle taken into account
// default to a little above max angle
angle = cruise_control_max_angle + 0.01f;
// if roll direction is downward then thrust value is taken from below max angle
if (rate < 0.0f) {
angle -= 0.02f;
// given the thrust at max_angle and actuatorDesired.Thrust
// (typically close to 1.0), change variable 'thrust' to
// be the proportion of the largest thrust change possible
// that occurs when going into inverted mode.
// Example: 'thrust' is 0.8 A quad has min_thrust set
// to 0.05 The difference is 0.75. The largest possible
// difference with this setup is 0.9 - 0.05 = 0.85, so
// the proportion is 0.75/0.85
// That is nearly a full throttle stroke.
// the 'thrust' variable is non-negative here
switch (cruise_control_inverted_power_output) {
case STABILIZATIONSETTINGS_CRUISECONTROLINVERTEDPOWEROUTPUT_ZERO:
// normal multi-copter case, stroke is max to zero
// technically max to constant min_thrust
// can be used by CP
thrust = (thrust - CruiseControlLimitThrust(0.0f)) / cruise_control_thrust_difference;
break;
case STABILIZATIONSETTINGS_CRUISECONTROLINVERTEDPOWEROUTPUT_NORMAL:
// reversed but not boosted
// : CP heli case, stroke is max to -stick
// : thrust = (thrust - CruiseControlLimitThrust(-actuatorDesired.Thrust)) / cruise_control_thrust_difference;
// else it is both unreversed and unboosted
// : simply turn off boost, stroke is max to +stick
// : thrust = (thrust - CruiseControlLimitThrust(actuatorDesired.Thrust)) / cruise_control_thrust_difference;
thrust = (thrust - CruiseControlLimitThrust(
(cruise_control_inverted_thrust_reversing
== STABILIZATIONSETTINGS_CRUISECONTROLINVERTEDTHRUSTREVERSING_REVERSED)
? -actuatorDesired.Thrust
: actuatorDesired.Thrust)) / cruise_control_thrust_difference;
break;
case STABILIZATIONSETTINGS_CRUISECONTROLINVERTEDPOWEROUTPUT_BOOSTED:
// if boosted and reversed
if (cruise_control_inverted_thrust_reversing
== STABILIZATIONSETTINGS_CRUISECONTROLINVERTEDTHRUSTREVERSING_REVERSED) {
// CP heli case, stroke is max to min
thrust = (thrust - CruiseControlFactorToThrust(-CruiseControlAngleToFactor(cruise_control_max_angle), actuatorDesired.Thrust)) / cruise_control_thrust_difference;
}
// else it is boosted and unreversed so the throttle doesn't change
else {
// CP heli case, no transition, so stroke is zero
thrust = 0.0f;
}
break;
}
}
// 'thrust' is now the proportion of max stroke
// multiply this proportion of max stroke,
// times the max stroke time, to get this stroke time
// we only want half of this time before the transition
// (and half after the transition)
thrust *= cruise_control_half_power_delay;
// 'thrust' is now the length of time for this stroke
// multiply that times angular rate to get the lead angle
thrust *= fabsf(rate);
// if the transition is within range we use it,
// else we just use the current calculated thrust
if (cruise_control_max_angle - thrust <= angle
&& angle <= cruise_control_max_angle + thrust) {
// default to a little above max angle
angle = cruise_control_max_angle + 0.01f;
// if roll direction is downward
// then thrust value is taken from below max angle
// by the code that knows about the transition angle
if (rate < 0.0f) {
angle -= 0.02f;
}
}
} // if thrust > 0.7; else just use the angle we already calculated
factor = CruiseControlAngleToFactor(angle);
} else { // if thrust > 0 set factor from angle; else
factor = 1.0f;
}
/*
convert these to enums? something like
upright power: zero, normal, boosted
inverted thrust direction: unchanged, reversed
inverted power: zero, normal, boosted
inverted yaw/pitch reverse: off, on
*/
inverted_flight_mode = false;
// if past max angle and so needing to go into an inverted mode
if (angle >= cruise_control_max_angle) {
// -3 inverted mode, -2 boosted reverse, -1 normal reverse, 0 zero power, 1 normal power, 2 boosted power
switch (cruise_control_inverted_power_switch) {
case -3: // reversed boosted thrust with pitch/yaw reverse
inverted_flight_mode = true;
factor = -factor;
break;
case -2: // reversed boosted thrust
factor = -factor;
break;
case -1: // reversed normal thrust
factor = -1.0f;
break;
case 0: // no thrust
switch (cruise_control_inverted_power_output) {
case STABILIZATIONSETTINGS_CRUISECONTROLINVERTEDPOWEROUTPUT_ZERO:
factor = 0.0f;
break;
case 1: // normal thrust
case STABILIZATIONSETTINGS_CRUISECONTROLINVERTEDPOWEROUTPUT_NORMAL:
factor = 1.0f;
break;
case 2: // normal boosted thrust
// no change to factor
case STABILIZATIONSETTINGS_CRUISECONTROLINVERTEDPOWEROUTPUT_BOOSTED:
// no change, leave factor >= 1.0 alone
break;
}
if (cruise_control_inverted_thrust_reversing
== STABILIZATIONSETTINGS_CRUISECONTROLINVERTEDTHRUSTREVERSING_REVERSED) {
factor = -factor;
}
}
} // if previous_time_valid i.e. we've got a rate; else leave (angle and) factor alone
previous_time = time;
@ -809,12 +795,9 @@ inverted yaw/pitch reverse: off, on
} // every 8th time
// don't touch thrust if it's less than min_thrust
// without this test, props will spin up to min thrust even at zero throttle stick
// without that test, quadcopter props will spin up
// to min thrust even at zero throttle stick
actuatorDesired.Thrust = CruiseControlFactorToThrust(factor, actuatorDesired.Thrust);
if (inverted_flight_mode) {
actuatorDesired.Pitch = -actuatorDesired.Pitch;
actuatorDesired.Yaw = -actuatorDesired.Yaw;
}
} // if Cruise Control is enabled on this flight switch position
if (flightStatus.ControlChain.Stabilization == FLIGHTSTATUS_CONTROLCHAIN_TRUE) {
@ -1008,9 +991,15 @@ static float CruiseControlAngleToFactor(float angle)
// assumes 1.0 <= factor <= 100.0
// a factor of less than 1.0 could make it return a value less than cruise_control_min_thrust
// CP helis need to have min_thrust=-1
//
// multicopters need to have min_thrust=0.05 or so
// values below that will not be subject to max / min limiting
// that means thrust can be less than min
// that means multicopter motors stop spinning at low stick
static float CruiseControlFactorToThrust(float factor, float thrust)
{
// don't touch if below min_thrust or we never get to full down stick
// don't touch if below min_thrust so we don't limit to min of min_thrust
// e.g. multicopter motors always spin
if (thrust > cruise_control_min_thrust) {
thrust = CruiseControlLimitThrust(thrust * factor);
@ -1019,9 +1008,6 @@ static float CruiseControlFactorToThrust(float factor, float thrust)
}
// we don't want to limit it to cruise_control_min_thrust on the low side
// because that is always close to zero, and CP helis need to run down to -1
// but CP needs to have min=-1
static float CruiseControlLimitThrust(float thrust)
{
// limit to user specified absolute max thrust
@ -1077,15 +1063,18 @@ static void SettingsUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
rattitude_mode_transition_stick_position = (float)settings.RattitudeModeTransition / 100.0f;
}
cruise_control_min_thrust = (float)settings.CruiseControlMinThrust / 100.0f;
cruise_control_max_thrust = (float)settings.CruiseControlMaxThrust / 100.0f;
cruise_control_max_angle = settings.CruiseControlMaxAngle;
cruise_control_max_power_factor = settings.CruiseControlMaxPowerFactor;
cruise_control_power_trim = settings.CruiseControlPowerTrim / 100.0f;
cruise_control_inverted_power_switch = settings.CruiseControlInvertedPowerSwitch;
cruise_control_half_power_delay = settings.CruiseControlPowerDelayComp / 2.0f;
cruise_control_max_power_factor_angle = RAD2DEG(acosf(1.0f / settings.CruiseControlMaxPowerFactor));
cruise_control_thrust_difference = cruise_control_max_thrust - cruise_control_min_thrust;
cruise_control_min_thrust = (float)settings.CruiseControlMinThrust / 100.0f;
cruise_control_max_thrust = (float)settings.CruiseControlMaxThrust / 100.0f;
cruise_control_thrust_difference = cruise_control_max_thrust - cruise_control_min_thrust;
cruise_control_max_angle = (float) settings.CruiseControlMaxAngle;
cruise_control_max_power_factor = settings.CruiseControlMaxPowerFactor;
cruise_control_power_trim = settings.CruiseControlPowerTrim / 100.0f;
cruise_control_half_power_delay = settings.CruiseControlPowerDelayComp / 2.0f;
cruise_control_max_power_factor_angle = RAD2DEG(acosf(1.0f / settings.CruiseControlMaxPowerFactor));
cruise_control_inverted_thrust_reversing = settings.CruiseControlInvertedThrustReversing;
cruise_control_inverted_power_output = settings.CruiseControlInvertedPowerOutput;
memcpy(
cruise_control_flight_mode_switch_pos_enable,

View File

@ -13377,8 +13377,6 @@ border-radius: 5;</string>
</property>
<property name="decimals">
<number>5</number>
</property>
<property name="singleStep">
<double>0.000100000000000</double>
@ -15943,7 +15941,6 @@ border-radius: 5;</string>
<string>element:Kp</string>
<string>haslimits:no</string>
<string>scale:1</string>
<string>buttongroup:5,20</string>
</stringlist>
</property>
@ -17355,7 +17352,6 @@ border-radius: 5;</string>
<red>26</red>
<green>26</green>
<blue>26</blue>
</color>
</brush>
</colorrole>
@ -19421,7 +19417,6 @@ border-radius: 5;</string>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255));
@ -19946,7 +19941,6 @@ border-radius: 5;</string>
<red>39</red>
<green>39</green>
<blue>39</blue>
</color>
</brush>
</colorrole>
@ -21981,7 +21975,6 @@ border-radius: 5;</string>
</size>
</property>
</spacer>
</item>
<item row="1" column="3">
<widget class="QDoubleSpinBox" name="AccelKp">
@ -24186,6 +24179,12 @@ border-radius: 5;</string>
</item>
<item row="1" column="0" colspan="2">
<widget class="QFrame" name="gridFrame">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<layout class="QGridLayout" name="gridLayout_25">
<property name="leftMargin">
<number>9</number>
@ -24200,30 +24199,23 @@ border-radius: 5;</string>
<number>9</number>
</property>
<item row="1" column="4">
<widget class="QDoubleSpinBox" name="doubleSpinBox_6">
<widget class="QComboBox" name="comboBox">
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;-3, -2, -1, 0, 1, or 2. Cruise Control uses this to determine the inverted power mode which is used if the bank angle is past MaxAngle. The default is 0 which says to turn the motors off (actually set them to MinThrust) when inverted. 1 says to use the unboosted stick value. 2 says use the boosted stick value. -1 (UNTESTED, for use by CP helis using idle up) says to reverse the collective channel when inverted. -2 is -1 but boosted. -3 is -2 but with pitch and yaw also inverted.
&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="accelerated">
<bool>true</bool>
</property>
<property name="decimals">
<number>0</number>
</property>
<property name="minimum">
<double>-3.000000000000000</double>
</property>
<property name="maximum">
<double>2.000000000000000</double>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;CP helis can set this to Reversed to automatically reverse the direction of thrust when inverted. Fixed pitch copters, including multicopters, should leave this set at Unreversed. Unreversed direction with Boosted power may be dangerous because it adds power and the thrust direction moves the aircraft towards the ground.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="objrelation" stdset="0">
<stringlist>
<string>objname:StabilizationSettings</string>
<string>fieldname:CruiseControlInvertedPowerSwitch</string>
<string>fieldname:CruiseControlInvertedThrustReversing</string>
<string>haslimits:no</string>
<string>scale:1</string>
<string>buttongroup:16</string>
@ -24231,6 +24223,39 @@ border-radius: 5;</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QLabel" name="label_10">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>145</width>
<height>16</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255));
color: rgb(255, 255, 255);
border-radius: 5;</string>
</property>
<property name="text">
<string>InvrtdThrustRev</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="5">
<spacer name="horizontalSpacer_59">
<property name="orientation">
@ -24247,7 +24272,7 @@ border-radius: 5;</string>
<item row="1" column="2">
<widget class="QDoubleSpinBox" name="doubleSpinBox_3">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This is the bank angle that CruiseControl goes into inverted / power disabled mode. The power for inverted mode is controlled by CruiseControlInvertedPowerSwitch&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The bank angle where CruiseControl goes into inverted power mode. InvertedThrustReverse and InvertedPower control the direction and amount of power when in inverted mode.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -24259,7 +24284,7 @@ border-radius: 5;</string>
<number>0</number>
</property>
<property name="maximum">
<double>180.000000000000000</double>
<double>255.000000000000000</double>
</property>
<property name="value">
<double>105.000000000000000</double>
@ -24278,7 +24303,7 @@ border-radius: 5;</string>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Really just a safety limit. 4.0 means it will not use more than 4 times the power the throttle/collective stick is requesting.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Really just a safety limit. 3.0 means it will not use more than 3 times the power the throttle/collective stick is requesting.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -24290,13 +24315,13 @@ border-radius: 5;</string>
<number>2</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
<double>1.000000000000000</double>
</property>
<property name="maximum">
<double>50.000000000000000</double>
</property>
<property name="singleStep">
<double>0.250000000000000</double>
<double>0.100000000000000</double>
</property>
<property name="value">
<double>3.000000000000000</double>
@ -24310,11 +24335,10 @@ border-radius: 5;</string>
<string>buttongroup:16</string>
</stringlist>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_6">
<widget class="QLabel" name="label_11">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -24323,7 +24347,7 @@ border-radius: 5;</string>
</property>
<property name="minimumSize">
<size>
<width>140</width>
<width>155</width>
<height>16</height>
</size>
</property>
@ -24339,84 +24363,13 @@ color: rgb(255, 255, 255);
border-radius: 5;</string>
</property>
<property name="text">
<string>PowerTrim</string>
<string>PowerDelayComp</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="3" column="4">
<widget class="QDoubleSpinBox" name="doubleSpinBox_7">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The fraction of a second it takes for your vehicle to go from zero thrust (10%) for multis (full negative thrust (-90%) for CP helis) to full positive thrust (+90%). Increase this if continuous left flips walk off to the left.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="accelerated">
<bool>true</bool>
</property>
<property name="decimals">
<number>5</number>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.001000000000000</double>
</property>
<property name="value">
<double>0.250000000000000</double>
</property>
<property name="objrelation" stdset="0">
<stringlist>
<string>objname:StabilizationSettings</string>
<string>fieldname:CruiseControlPowerDelayComp</string>
<string>haslimits:no</string>
<string>scale:1</string>
<string>buttongroup:16</string>
</stringlist>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_2">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If you find that banging the stick around a lot makes the copter climb a bit, adjust this number down a little.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="accelerated">
<bool>true</bool>
</property>
<property name="decimals">
<number>2</number>
</property>
<property name="minimum">
<double>80.000000000000000</double>
</property>
<property name="maximum">
<double>120.000000000000000</double>
</property>
<property name="singleStep">
<double>0.250000000000000</double>
</property>
<property name="value">
<double>100.000000000000000</double>
</property>
<property name="objrelation" stdset="0">
<stringlist>
<string>objname:StabilizationSettings</string>
<string>fieldname:CruiseControlPowerTrim</string>
<string>haslimits:no</string>
<string>scale:1</string>
<string>buttongroup:16</string>
</stringlist>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
@ -24460,7 +24413,7 @@ border-radius: 5;</string>
</property>
<property name="minimumSize">
<size>
<width>140</width>
<width>90</width>
<height>16</height>
</size>
</property>
@ -24493,7 +24446,7 @@ border-radius: 5;</string>
</property>
<property name="minimumSize">
<size>
<width>140</width>
<width>92</width>
<height>16</height>
</size>
</property>
@ -24519,7 +24472,7 @@ border-radius: 5;</string>
<item row="1" column="3">
<widget class="QDoubleSpinBox" name="doubleSpinBox_4">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Throttle/Collective stick below this disables Cruise Control. Also, by default Cruise Control forces the use of this value for thrust when the copter is inverted. For safety, never set this so low that the trimmed throttle/collective stick cannot get below it.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Throttle/Collective stick below this amount disables Cruise Control. Also, by default Cruise Control forces the use of this value for thrust when InvertedPower setting is Zero and the copter is inverted. CP helis probably want this set to -100%. For safety with fixed pitch copters (including multicopters), never set this so low that the trimmed throttle stick cannot get below it or your motor(s) will still run with the throttle stick all the way down. Fixed pitch throttle sticks go from -100 to 0 in the first tiny bit of throttle stick (and then up to 100 using the rest of the throttle range), so for example, a lot of &amp;quot;high throttle trim&amp;quot; will keep the stick from ever commanding less than 5% so it won't be possible to stop the motors with the throttle stick. Banking the copter in your hand in this state will make the motors speed up.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -24530,6 +24483,12 @@ border-radius: 5;</string>
<property name="decimals">
<number>0</number>
</property>
<property name="minimum">
<double>-100.000000000000000</double>
</property>
<property name="maximum">
<double>49.000000000000000</double>
</property>
<property name="value">
<double>5.000000000000000</double>
</property>
@ -24544,43 +24503,10 @@ border-radius: 5;</string>
</property>
</widget>
</item>
<item row="2" column="4">
<widget class="QLabel" name="label_11">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>140</width>
<height>16</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255));
color: rgb(255, 255, 255);
border-radius: 5;</string>
</property>
<property name="text">
<string>PowerDelayComp</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QDoubleSpinBox" name="doubleSpinBox_5">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Multi-copters should probably use 90% to 95% to leave some headroom for stabilization. CP helis can set this to 100%.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Multi-copters should probably use 80% to 90% to leave some headroom for stabilization. CP helis can set this to 100%.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -24591,6 +24517,9 @@ border-radius: 5;</string>
<property name="decimals">
<number>0</number>
</property>
<property name="minimum">
<double>51.000000000000000</double>
</property>
<property name="value">
<double>90.000000000000000</double>
</property>
@ -24615,7 +24544,7 @@ border-radius: 5;</string>
</property>
<property name="minimumSize">
<size>
<width>140</width>
<width>97</width>
<height>16</height>
</size>
</property>
@ -24638,8 +24567,24 @@ border-radius: 5;</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QLabel" name="label_10">
<item row="1" column="0">
<spacer name="horizontalSpacer_60">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>90</width>
<height>11</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="2">
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -24648,7 +24593,68 @@ border-radius: 5;</string>
</property>
<property name="minimumSize">
<size>
<width>140</width>
<width>97</width>
<height>16</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255));
color: rgb(255, 255, 255);
border-radius: 5;</string>
</property>
<property name="text">
<string>PowerTrim</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_7">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Moves the inverted mode power switching this fraction of a second into the future to compensate for slow responding power systems. Used to more accurately time the changing of power when entering/exiting inverted mode. Set this to equal the fraction of a second it takes for your vehicle to go from full negative thrust (10% positive thrust for multis, full negative thrust (-90%) for CP helis) to full positive thrust (+90%). Increase this if for example continuous left flips &amp;quot;walk off&amp;quot; to the left because power is changed too late.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="accelerated">
<bool>true</bool>
</property>
<property name="decimals">
<number>5</number>
</property>
<property name="maximum">
<double>2.000000000000000</double>
</property>
<property name="singleStep">
<double>0.001000000000000</double>
</property>
<property name="value">
<double>0.250000000000000</double>
</property>
<property name="objrelation" stdset="0">
<stringlist>
<string>objname:StabilizationSettings</string>
<string>fieldname:CruiseControlPowerDelayComp</string>
<string>haslimits:no</string>
<string>scale:1</string>
<string>buttongroup:16</string>
</stringlist>
</property>
</widget>
</item>
<item row="2" column="4">
<widget class="QLabel" name="label_12">
<property name="minimumSize">
<size>
<width>120</width>
<height>16</height>
</size>
</property>
@ -24671,21 +24677,58 @@ border-radius: 5;</string>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_60">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="3" column="2">
<widget class="QDoubleSpinBox" name="doubleSpinBox_2">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If you find that quickly moving the stick around a lot makes the copter climb a bit, adjust this number down a little. It will be a compromise between climbing a little with lots of stick motion and descending a little with minimal stick motion.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>90</width>
<height>11</height>
</size>
<property name="accelerated">
<bool>true</bool>
</property>
</spacer>
<property name="decimals">
<number>2</number>
</property>
<property name="minimum">
<double>50.000000000000000</double>
</property>
<property name="maximum">
<double>200.000000000000000</double>
</property>
<property name="singleStep">
<double>0.250000000000000</double>
</property>
<property name="value">
<double>100.000000000000000</double>
</property>
<property name="objrelation" stdset="0">
<stringlist>
<string>objname:StabilizationSettings</string>
<string>fieldname:CruiseControlPowerTrim</string>
<string>haslimits:no</string>
<string>scale:1</string>
<string>buttongroup:16</string>
</stringlist>
</property>
</widget>
</item>
<item row="3" column="4">
<widget class="QComboBox" name="comboBox_2">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The amount of power used when in inverted mode. Zero (min throttle stick for fixed pitch copters includding multicopters, neutral collective for CP), Normal (uses stick value), or Boosted (boosted according to bank angle). Beginning multicopter pilots should leave this set to Zero to automatically reduce throttle during flips. Boosted power with Unreversed direction may be dangerous because it adds power and the thrust direction moves the aircraft towards the ground.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="objrelation" stdset="0">
<stringlist>
<string>objname:StabilizationSettings</string>
<string>fieldname:CruiseControlInvertedPowerOutput</string>
<string>haslimits:no</string>
<string>scale:1</string>
<string>buttongroup:16</string>
</stringlist>
</property>
</widget>
</item>
</layout>
</widget>

View File

@ -30,15 +30,17 @@
<field name="RattitudeModeTransition" units="%" type="uint8" elements="1" defaultvalue="80"/>
<field name="CruiseControlMinThrust" units="%" type="uint8" elements="1" defaultvalue="5"/>
<field name="CruiseControlMinThrust" units="%" type="int8" elements="1" defaultvalue="5"/>
<field name="CruiseControlMaxThrust" units="%" type="uint8" elements="1" defaultvalue="90"/>
<field name="CruiseControlMaxAngle" units="deg" type="uint8" elements="1" defaultvalue="105"/>
<field name="CruiseControlMaxPowerFactor" units="x" type="float" elements="1" defaultvalue="3.0"/>
<field name="CruiseControlPowerTrim" units="%" type="float" elements="1" defaultvalue="100.0"/>
<field name="CruiseControlInvertedPowerSwitch" units="" type="int8" elements="1" defaultvalue="0"/>
<field name="CruiseControlPowerDelayComp" units="sec" type="float" elements="1" defaultvalue="0.25"/>
<field name="CruiseControlFlightModeSwitchPosEnable" units="" type="enum" elements="6" options="FALSE,TRUE" defaultvalue="FALSE"/>
<field name="CruiseControlInvertedThrustReversing" units="" type="enum" elements="1" options="Unreversed,Reversed" defaultvalue="Unchanged"/>
<field name="CruiseControlInvertedPowerOutput" units="" type="enum" elements="1" options="Zero,Normal,Boosted" defaultvalue="Zero"/>
<field name="LowThrottleZeroIntegral" units="" type="enum" elements="1" options="FALSE,TRUE" defaultvalue="TRUE"/>
<field name="ScaleToAirspeed" units="m/s" type="float" elements="1" defaultvalue="0"/>