Browse Source

Correctly check reverse thrust conditions

sbg
sanderux 8 years ago committed by Sander Smeets
parent
commit
7a8d3c4ab2
  1. 14
      src/modules/vtol_att_control/standard.cpp

14
src/modules/vtol_att_control/standard.cpp

@ -185,14 +185,8 @@ void Standard::update_vtol_state() @@ -185,14 +185,8 @@ void Standard::update_vtol_state()
_vtol_schedule.flight_mode = TRANSITION_TO_MC;
_flag_enable_mc_motors = true;
_vtol_schedule.transition_start = hrt_absolute_time();
_pusher_throttle = _params_standard.reverse_throttle;
_reverse_output = _params_standard.reverse_output;
// prevent positive thrust without control channel activated
if (_pusher_throttle > FLT_EPSILON && _reverse_output < 0.01f) {
_pusher_throttle = 0.0f;
}
}
} else if (_vtol_schedule.flight_mode == TRANSITION_TO_FW) {
@ -352,12 +346,18 @@ void Standard::update_transition_state() @@ -352,12 +346,18 @@ void Standard::update_transition_state()
q_sp.copyTo(_v_att_sp->q_d);
_v_att_sp->q_d_valid = true;
if (_params_handles_standard.reverse_throttle > FLT_EPSILON || _params_handles_standard.reverse_throttle < 0.01f) {
// Handle throttle reversal for active breaking
if (_params_handles_standard.reverse_throttle > FLT_EPSILON || _params_handles_standard.reverse_throttle < -0.01f) {
_pusher_throttle = _params_standard.reverse_throttle * (float)hrt_elapsed_time(&_vtol_schedule.transition_start) /
(_params_standard.front_trans_dur * 1000000.0f);
_pusher_throttle = math::constrain(_pusher_throttle, -1.0f, _params_standard.reverse_throttle);
}
// prevent positive thrust without airbrakes channel activated
if (_pusher_throttle > FLT_EPSILON && _params_handles_standard.reverse_output < 0.01f) {
_pusher_throttle = 0.0f;
}
// continually increase mc attitude control as we transition back to mc mode
if (_params_standard.back_trans_ramp > FLT_EPSILON) {
float weight = (float)hrt_elapsed_time(&_vtol_schedule.transition_start) /

Loading…
Cancel
Save