diff --git a/src/modules/vtol_att_control/standard.cpp b/src/modules/vtol_att_control/standard.cpp index 4e56865b216..6a426bcbab5 100644 --- a/src/modules/vtol_att_control/standard.cpp +++ b/src/modules/vtol_att_control/standard.cpp @@ -155,8 +155,6 @@ void Standard::update_transition_state() _last_time_pusher_transition_update = now; } - _airspeed_trans_blend_margin = getTransitionAirspeed() - getBlendAirspeed(); - float airspeed = _attc->get_calibrated_airspeed(); if (!PX4_ISFINITE(airspeed)) { @@ -164,13 +162,9 @@ void Standard::update_transition_state() airspeed = getTransitionAirspeed() * _time_since_trans_start / getOpenLoopFrontTransitionTime(); } - // do blending of mc and fw controls if a blending airspeed has been provided and the minimum transition time has passed - if (_airspeed_trans_blend_margin > 0.0f && - airspeed > 0.0f && - airspeed >= getBlendAirspeed() && - _time_since_trans_start > getMinimumFrontTransitionTime()) { - - mc_weight = 1.0f - fabsf(airspeed - getBlendAirspeed()) / _airspeed_trans_blend_margin; + // blend mc and fw controls between blend and transition airspeed once the minimum transition time has passed + if (_time_since_trans_start > getMinimumFrontTransitionTime()) { + mc_weight = math::interpolate(airspeed, getBlendAirspeed(), getTransitionAirspeed(), 1.f, 0.f); } // ramp up FW_PSP_OFF @@ -178,7 +172,6 @@ void Standard::update_transition_state() _v_att_sp->thrust_body[0] = _pusher_throttle; const Quatf q_sp(Eulerf(roll_body, pitch_body, yaw_body)); q_sp.copyTo(_v_att_sp->q_d); - mc_weight = math::constrain(mc_weight, 0.0f, 1.0f); } else if (_common_vtol_mode == mode::TRANSITION_TO_MC) { diff --git a/src/modules/vtol_att_control/standard.h b/src/modules/vtol_att_control/standard.h index 3da989752ff..3354e84d4a7 100644 --- a/src/modules/vtol_att_control/standard.h +++ b/src/modules/vtol_att_control/standard.h @@ -67,7 +67,6 @@ public: private: float _pusher_throttle{0.0f}; - float _airspeed_trans_blend_margin{0.0f}; hrt_abstime _last_time_pusher_transition_update{0}; float _front_transition_pitch{NAN};