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

OP-1160 limit values in flight code (not just GCS) to avoid DZ. Set GCS tab index back to 0.

This commit is contained in:
Cliff Geerdes 2014-03-17 22:40:19 -04:00
parent 390533f2e3
commit 1cb9d9548f
2 changed files with 14 additions and 4 deletions

View File

@ -442,7 +442,8 @@ static void stabilizationTask(__attribute__((unused)) void *parameters)
// when a small number of degrees off of where it should be
// if below the transition angle (still in attitude mode)
if (magnitude < rattitude_mode_transition_stick_position) {
// '<=' instead of ',' keeps rattitude_mode_transition_stick_position==1.0 from causing DZ
if (magnitude <= rattitude_mode_transition_stick_position) {
magnitude *= STICK_VALUE_AT_MODE_TRANSITION / rattitude_mode_transition_stick_position;
} else {
magnitude = (magnitude - rattitude_mode_transition_stick_position) * (1.0f-STICK_VALUE_AT_MODE_TRANSITION) / (1.0f - rattitude_mode_transition_stick_position) + STICK_VALUE_AT_MODE_TRANSITION;
@ -825,8 +826,12 @@ static void SettingsUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
// force flight mode update
cur_flight_mode = -1;
// Rattitude flight mode anti-windup factor
rattitude_mode_transition_stick_position = (float)settings.RattitudeModeTransistion / 100.0f;
// Rattitude stick angle where the attitude to rate transition happens
if (settings.RattitudeModeTransistion < (uint8_t) 10) {
rattitude_mode_transition_stick_position = 10.0f / 100.0f;
} else {
rattitude_mode_transition_stick_position = (float)settings.RattitudeModeTransistion / 100.0f;
}
cruise_control_min_thrust = (float)settings.CruiseControlMinThrust / 100.0f;
cruise_control_max_thrust = (float)settings.CruiseControlMaxThrust / 100.0f;

View File

@ -95,7 +95,7 @@
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
<number>3</number>
<number>0</number>
</property>
<property name="documentMode">
<bool>false</bool>
@ -13377,6 +13377,7 @@ border-radius: 5;</string>
</property>
<property name="decimals">
<number>5</number>
</property>
<property name="singleStep">
<double>0.000100000000000</double>
@ -19417,6 +19418,7 @@ 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));
@ -19941,6 +19943,7 @@ border-radius: 5;</string>
<red>39</red>
<green>39</green>
<blue>39</blue>
</color>
</brush>
</colorrole>
@ -21975,6 +21978,7 @@ border-radius: 5;</string>
</size>
</property>
</spacer>
</item>
<item row="1" column="3">
<widget class="QDoubleSpinBox" name="AccelKp">
@ -26158,6 +26162,7 @@ border-radius: 5;</string>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="styleSheet">
<string notr="true"/>