From b61cf72b8c3c5781a1c3c4685e8217bd715ee337 Mon Sep 17 00:00:00 2001 From: Iampete1 Date: Mon, 24 Aug 2020 17:44:50 +0100 Subject: [PATCH] Plane: tailsitters in Qassist inherit motor state --- ArduPlane/mode.cpp | 14 ++++++++++++++ ArduPlane/mode.h | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ArduPlane/mode.cpp b/ArduPlane/mode.cpp index 74ac0138d4..63683250e3 100644 --- a/ArduPlane/mode.cpp +++ b/ArduPlane/mode.cpp @@ -86,3 +86,17 @@ bool Mode::enter() return enter_result; } +bool Mode::is_vtol_man_throttle() const +{ + if (!plane.quadplane.in_vtol_mode() && + plane.quadplane.is_tailsitter() && + plane.quadplane.tailsitter_transition_fw_complete() && + plane.quadplane.assisted_flight) { + // a tailsitter that has fully transisisoned to Q-assisted forward flight + // in this case the forward throttle directly drives the vertical throttle + // set vertical throttle state to match the forward throttle state. Confusingly the booleans are inverted, + // forward throttle uses 'auto_throttle_mode' whereas vertical used 'is_vtol_man_throttle' + return !plane.auto_throttle_mode; + } + return false; +} diff --git a/ArduPlane/mode.h b/ArduPlane/mode.h index 1474d4d6d0..96b8605d82 100644 --- a/ArduPlane/mode.h +++ b/ArduPlane/mode.h @@ -71,7 +71,7 @@ public: // true for all q modes virtual bool is_vtol_mode() const { return false; } - virtual bool is_vtol_man_throttle() const { return false; } + virtual bool is_vtol_man_throttle() const; virtual bool is_vtol_man_mode() const { return false; } // guided or adsb mode virtual bool is_guided_mode() const { return false; }