diff --git a/ArduPlane/mode_auto.cpp b/ArduPlane/mode_auto.cpp index ff880e33bd..6ebf3546ef 100644 --- a/ArduPlane/mode_auto.cpp +++ b/ArduPlane/mode_auto.cpp @@ -17,8 +17,6 @@ bool ModeAuto::_enter() if (plane.quadplane.available() && plane.quadplane.enable == 2) { plane.auto_state.vtol_mode = true; - // always zero forward throttle demand on entry into VTOL modes - quadplane.q_fwd_throttle = 0.0f; } else { plane.auto_state.vtol_mode = false; } diff --git a/ArduPlane/mode_qacro.cpp b/ArduPlane/mode_qacro.cpp index 13b16a066e..b74a434384 100644 --- a/ArduPlane/mode_qacro.cpp +++ b/ArduPlane/mode_qacro.cpp @@ -5,9 +5,6 @@ bool ModeQAcro::_enter() { - // always zero forward throttle demand on entry into VTOL modes - quadplane.q_fwd_throttle = 0.0f; - quadplane.throttle_wait = false; quadplane.transition->force_transition_complete(); attitude_control->relax_attitude_controllers(); diff --git a/ArduPlane/mode_qautotune.cpp b/ArduPlane/mode_qautotune.cpp index 5d50f8b7c5..28bf977128 100644 --- a/ArduPlane/mode_qautotune.cpp +++ b/ArduPlane/mode_qautotune.cpp @@ -7,9 +7,6 @@ bool ModeQAutotune::_enter() { - // always zero forward throttle demand on entry into VTOL modes - quadplane.q_fwd_throttle = 0.0f; - #if QAUTOTUNE_ENABLED return quadplane.qautotune.init(); #else diff --git a/ArduPlane/mode_qhover.cpp b/ArduPlane/mode_qhover.cpp index 0553c8dfae..1fe4848296 100644 --- a/ArduPlane/mode_qhover.cpp +++ b/ArduPlane/mode_qhover.cpp @@ -5,9 +5,6 @@ bool ModeQHover::_enter() { - // always zero forward throttle demand on entry into VTOL modes - quadplane.q_fwd_throttle = 0.0f; - // set vertical speed and acceleration limits pos_control->set_max_speed_accel_z(-quadplane.get_pilot_velocity_z_max_dn(), quadplane.pilot_velocity_z_max_up, quadplane.pilot_accel_z); pos_control->set_correction_speed_accel_z(-quadplane.get_pilot_velocity_z_max_dn(), quadplane.pilot_velocity_z_max_up, quadplane.pilot_accel_z); diff --git a/ArduPlane/mode_qland.cpp b/ArduPlane/mode_qland.cpp index 11b2bcbeea..e646c80746 100644 --- a/ArduPlane/mode_qland.cpp +++ b/ArduPlane/mode_qland.cpp @@ -5,9 +5,6 @@ bool ModeQLand::_enter() { - // always zero forward throttle demand on entry into VTOL modes - quadplane.q_fwd_throttle = 0.0f; - plane.mode_qloiter._enter(); quadplane.throttle_wait = false; quadplane.setup_target_position(); diff --git a/ArduPlane/mode_qloiter.cpp b/ArduPlane/mode_qloiter.cpp index fe3a936d30..50dd8deea7 100644 --- a/ArduPlane/mode_qloiter.cpp +++ b/ArduPlane/mode_qloiter.cpp @@ -5,9 +5,6 @@ bool ModeQLoiter::_enter() { - // always zero forward throttle demand on entry into VTOL modes - quadplane.q_fwd_throttle = 0.0f; - // initialise loiter loiter_nav->clear_pilot_desired_acceleration(); loiter_nav->init_target(); diff --git a/ArduPlane/mode_qrtl.cpp b/ArduPlane/mode_qrtl.cpp index e4545c01d8..e31e4681ad 100644 --- a/ArduPlane/mode_qrtl.cpp +++ b/ArduPlane/mode_qrtl.cpp @@ -5,9 +5,6 @@ bool ModeQRTL::_enter() { - // always zero forward throttle demand on entry into VTOL modes - plane.quadplane.q_fwd_throttle = 0.0f; - // treat QRTL as QLAND if we are in guided wait takeoff state, to cope // with failsafes during GUIDED->AUTO takeoff sequence if (plane.quadplane.guided_wait_takeoff_on_mode_enter) { diff --git a/ArduPlane/mode_qstabilize.cpp b/ArduPlane/mode_qstabilize.cpp index 61c79582d2..b0b3f27a18 100644 --- a/ArduPlane/mode_qstabilize.cpp +++ b/ArduPlane/mode_qstabilize.cpp @@ -5,9 +5,6 @@ bool ModeQStabilize::_enter() { - // always zero forward throttle demand on entry into VTOL modes - quadplane.q_fwd_throttle = 0.0f; - quadplane.throttle_wait = false; return true; } diff --git a/ArduPlane/quadplane.cpp b/ArduPlane/quadplane.cpp index f896c7fa89..03f01c7f28 100644 --- a/ArduPlane/quadplane.cpp +++ b/ArduPlane/quadplane.cpp @@ -2088,7 +2088,7 @@ bool QuadPlane::handle_do_vtol_transition(enum MAV_VTOL_STATE state) const gcs().send_text(MAV_SEVERITY_NOTICE, "Entered VTOL mode"); } plane.auto_state.vtol_mode = true; - // always zero forward throttle demand on entry into VTOL modes + // This is a precaustion. It should be looked after by the call to QuadPlane::mode_enter(void) on mode entry. plane.quadplane.q_fwd_throttle = 0.0f; return true; @@ -4511,6 +4511,8 @@ void QuadPlane::mode_enter(void) // state for special behaviour guided_wait_takeoff_on_mode_enter = guided_wait_takeoff; guided_wait_takeoff = false; + + q_fwd_throttle = 0.0f; } // Set attitude control yaw rate time constant to pilot input command model value