Line data Source code
1 : #include "mode.h" 2 : #include "Plane.h" 3 : 4 : #include "qautotune.h" 5 : 6 : #if QAUTOTUNE_ENABLED 7 : 8 1 : bool ModeQAutotune::_enter() 9 : { 10 : #if QAUTOTUNE_ENABLED 11 1 : return quadplane.qautotune.init(); 12 : #else 13 : return false; 14 : #endif 15 : } 16 : 17 130153 : void ModeQAutotune::update() 18 : { 19 130153 : plane.mode_qstabilize.update(); 20 130153 : } 21 : 22 130153 : void ModeQAutotune::run() 23 : { 24 130153 : const uint32_t now = AP_HAL::millis(); 25 130153 : if (quadplane.tailsitter.in_vtol_transition(now)) { 26 : // Tailsitters in FW pull up phase of VTOL transition run FW controllers 27 0 : Mode::run(); 28 0 : return; 29 : } 30 : 31 : #if QAUTOTUNE_ENABLED 32 130153 : quadplane.qautotune.run(); 33 : #endif 34 : 35 : // Stabilize with fixed wing surfaces 36 130153 : plane.stabilize_roll(); 37 130153 : plane.stabilize_pitch(); 38 : 39 : // Center rudder 40 130153 : output_rudder_and_steering(0.0); 41 : } 42 : 43 0 : void ModeQAutotune::_exit() 44 : { 45 : #if QAUTOTUNE_ENABLED 46 0 : plane.quadplane.qautotune.stop(); 47 : #endif 48 0 : } 49 : 50 : #endif