mirror of https://github.com/ArduPilot/ardupilot
APM: fixed stick mixing for STABILISE mode
this is embarrassing
This commit is contained in:
parent
8807758693
commit
061c676cc6
|
@ -38,22 +38,19 @@ static float get_speed_scaler(void)
|
||||||
*/
|
*/
|
||||||
static bool stick_mixing_enabled(void)
|
static bool stick_mixing_enabled(void)
|
||||||
{
|
{
|
||||||
if (control_mode == CIRCLE && failsafe != FAILSAFE_NONE) {
|
if (control_mode == CIRCLE || control_mode > FLY_BY_WIRE_B) {
|
||||||
// we are in short failsafe
|
// we're in an auto mode. Check the stick mixing flag
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (control_mode < FLY_BY_WIRE_A) {
|
|
||||||
// pilot has control, always mix in pilot controls
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (g.stick_mixing &&
|
if (g.stick_mixing &&
|
||||||
geofence_stickmixing() &&
|
geofence_stickmixing() &&
|
||||||
failsafe == FAILSAFE_NONE) {
|
failsafe == FAILSAFE_NONE) {
|
||||||
// we're in an auto mode, and haven't triggered failsafe
|
// we're in an auto mode, and haven't triggered failsafe
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
// we should not do stick mixing
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// non-auto mode. Always do stick mixing
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,8 +97,9 @@ static void stabilize()
|
||||||
// Mix Stick input to allow users to override control surfaces
|
// Mix Stick input to allow users to override control surfaces
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
if (stick_mixing_enabled()) {
|
if (stick_mixing_enabled()) {
|
||||||
if (control_mode > FLY_BY_WIRE_B) {
|
if (control_mode < FLY_BY_WIRE_A || control_mode > FLY_BY_WIRE_C) {
|
||||||
// do stick mixing in auto modes
|
// do stick mixing on aileron/elevator if not in a fly by
|
||||||
|
// wire mode
|
||||||
ch1_inf = (float)g.channel_roll.radio_in - (float)g.channel_roll.radio_trim;
|
ch1_inf = (float)g.channel_roll.radio_in - (float)g.channel_roll.radio_trim;
|
||||||
ch1_inf = fabs(ch1_inf);
|
ch1_inf = fabs(ch1_inf);
|
||||||
ch1_inf = min(ch1_inf, 400.0);
|
ch1_inf = min(ch1_inf, 400.0);
|
||||||
|
@ -123,8 +121,7 @@ static void stabilize()
|
||||||
g.channel_pitch.servo_out += g.channel_pitch.pwm_to_angle();
|
g.channel_pitch.servo_out += g.channel_pitch.pwm_to_angle();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (control_mode >= FLY_BY_WIRE_A) {
|
// stick mixing performed for rudder for all cases including FBW
|
||||||
// stick mixing performed for rudder for all cases including FBW unless disabled for higher modes
|
|
||||||
// important for steering on the ground during landing
|
// important for steering on the ground during landing
|
||||||
// -----------------------------------------------
|
// -----------------------------------------------
|
||||||
ch4_inf = (float)g.channel_rudder.radio_in - (float)g.channel_rudder.radio_trim;
|
ch4_inf = (float)g.channel_rudder.radio_in - (float)g.channel_rudder.radio_trim;
|
||||||
|
@ -132,7 +129,6 @@ static void stabilize()
|
||||||
ch4_inf = min(ch4_inf, 400.0);
|
ch4_inf = min(ch4_inf, 400.0);
|
||||||
ch4_inf = ((400.0 - ch4_inf) /400.0);
|
ch4_inf = ((400.0 - ch4_inf) /400.0);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Apply output to Rudder
|
// Apply output to Rudder
|
||||||
// ----------------------
|
// ----------------------
|
||||||
|
|
Loading…
Reference in New Issue