From 37be15b3cdc89741a06a910c6ce3ec14ebdb9f1b Mon Sep 17 00:00:00 2001 From: Michael du Breuil Date: Mon, 30 Mar 2020 20:49:40 -0700 Subject: [PATCH] Plane: When stick mixing is disabled do not apply stick mixing to quadplane modes --- ArduPlane/Attitude.cpp | 1 + ArduPlane/GCS_Mavlink.cpp | 8 +++++--- ArduPlane/Parameters.cpp | 4 ++-- ArduPlane/defines.h | 3 ++- ArduPlane/quadplane.cpp | 4 ++++ 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ArduPlane/Attitude.cpp b/ArduPlane/Attitude.cpp index f9b6a03247..6b3a80a414 100644 --- a/ArduPlane/Attitude.cpp +++ b/ArduPlane/Attitude.cpp @@ -57,6 +57,7 @@ bool Plane::stick_mixing_enabled(void) if (auto_throttle_mode && auto_navigation_mode) { // we're in an auto mode. Check the stick mixing flag if (g.stick_mixing != STICK_MIXING_DISABLED && + g.stick_mixing != STICK_MIXING_VTOL_YAW && geofence_stickmixing() && failsafe.state == FAILSAFE_NONE && !rc_failsafe_active()) { diff --git a/ArduPlane/GCS_Mavlink.cpp b/ArduPlane/GCS_Mavlink.cpp index 7a1a1a9678..838e37f5a8 100644 --- a/ArduPlane/GCS_Mavlink.cpp +++ b/ArduPlane/GCS_Mavlink.cpp @@ -66,9 +66,11 @@ MAV_MODE GCS_MAVLINK_Plane::base_mode() const } if (plane.g.stick_mixing != STICK_MIXING_DISABLED && plane.control_mode != &plane.mode_initializing) { - // all modes except INITIALISING have some form of manual - // override if stick mixing is enabled - _base_mode |= MAV_MODE_FLAG_MANUAL_INPUT_ENABLED; + if ((plane.g.stick_mixing != STICK_MIXING_VTOL_YAW) || (plane.control_mode == &plane.mode_auto)) { + // all modes except INITIALISING have some form of manual + // override if stick mixing is enabled + _base_mode |= MAV_MODE_FLAG_MANUAL_INPUT_ENABLED; + } } #if HIL_SUPPORT diff --git a/ArduPlane/Parameters.cpp b/ArduPlane/Parameters.cpp index b319e16193..1893f0d65d 100644 --- a/ArduPlane/Parameters.cpp +++ b/ArduPlane/Parameters.cpp @@ -105,8 +105,8 @@ const AP_Param::Info Plane::var_info[] = { // @Param: STICK_MIXING // @DisplayName: Stick Mixing - // @Description: When enabled, this adds user stick input to the control surfaces in auto modes, allowing the user to have some degree of flight control without changing modes. There are two types of stick mixing available. If you set STICK_MIXING to 1 then it will use "fly by wire" mixing, which controls the roll and pitch in the same way that the FBWA mode does. This is the safest option if you usually fly ArduPlane in FBWA or FBWB mode. If you set STICK_MIXING to 2 then it will enable direct mixing mode, which is what the STABILIZE mode uses. That will allow for much more extreme maneuvers while in AUTO mode. - // @Values: 0:Disabled,1:FBWMixing,2:DirectMixing + // @Description: When enabled, this adds user stick input to the control surfaces in auto modes, allowing the user to have some degree of flight control without changing modes. There are two types of stick mixing available. If you set STICK_MIXING to 1 then it will use "fly by wire" mixing, which controls the roll and pitch in the same way that the FBWA mode does. This is the safest option if you usually fly ArduPlane in FBWA or FBWB mode. If you set STICK_MIXING to 2 then it will enable direct mixing mode, which is what the STABILIZE mode uses. That will allow for much more extreme maneuvers while in AUTO mode. If you set STICK_MIXING to 3 then it will apply to the yaw while in quadplane modes only, such as while doing an automatic VTOL takeoff or landing. + // @Values: 0:Disabled,1:FBWMixing,2:DirectMixing,3:VTOL Yaw only // @User: Advanced GSCALAR(stick_mixing, "STICK_MIXING", STICK_MIXING_FBW), diff --git a/ArduPlane/defines.h b/ArduPlane/defines.h index 017b6d9d4c..57c093f01a 100644 --- a/ArduPlane/defines.h +++ b/ArduPlane/defines.h @@ -49,7 +49,8 @@ enum failsafe_action_long { enum StickMixing { STICK_MIXING_DISABLED = 0, STICK_MIXING_FBW = 1, - STICK_MIXING_DIRECT = 2 + STICK_MIXING_DIRECT = 2, + STICK_MIXING_VTOL_YAW = 3, }; enum ChannelMixing { diff --git a/ArduPlane/quadplane.cpp b/ArduPlane/quadplane.cpp index e21aa0d546..08eafdad31 100644 --- a/ArduPlane/quadplane.cpp +++ b/ArduPlane/quadplane.cpp @@ -1308,6 +1308,10 @@ float QuadPlane::get_pilot_input_yaw_rate_cds(void) const return 0; } + if (plane.g.stick_mixing == STICK_MIXING_DISABLED) { + return 0; + } + // add in rudder input float max_rate = yaw_rate_max; if (is_tailsitter() &&