From cea2350d2e66332a7048fbb253599269dc1d0f03 Mon Sep 17 00:00:00 2001 From: sander Date: Tue, 21 Jun 2016 21:57:30 +0200 Subject: [PATCH] Time based front transition blending --- src/modules/vtol_att_control/standard.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/modules/vtol_att_control/standard.cpp b/src/modules/vtol_att_control/standard.cpp index ce2d978436..c49bc61d06 100644 --- a/src/modules/vtol_att_control/standard.cpp +++ b/src/modules/vtol_att_control/standard.cpp @@ -249,6 +249,18 @@ void Standard::update_transition_state() _mc_yaw_weight = weight; _mc_throttle_weight = weight; + // time based blending when no airspeed sensor is set + } else if (_params_standard.airspeed_mode == 2 && + (float)hrt_elapsed_time(&_vtol_schedule.transition_start) < (_params_standard.front_trans_time_min * 1000000.0f) + ) { + float weight = 1.0f - (float)(hrt_elapsed_time(&_vtol_schedule.transition_start) / (_params_standard.front_trans_time_min * 1000000.0f)); + printf("weight: %f \n", (double)weight); + _mc_roll_weight = weight; + _mc_pitch_weight = weight; + _mc_yaw_weight = weight; + _mc_throttle_weight = weight; + + } else { // at low speeds give full weight to mc _mc_roll_weight = 1.0f;