mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 16:48:52 +08:00
tailsitter: guard against division by 0
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
@@ -234,7 +234,8 @@ void Tailsitter::update_transition_state()
|
||||
|
||||
if (_vtol_schedule.flight_mode == vtol_mode::TRANSITION_FRONT_P1) {
|
||||
|
||||
const float trans_pitch_rate = M_PI_2_F / _param_vt_f_trans_dur.get() ;
|
||||
// calculate pitching rate - and constrain to at least 0.1s transition time
|
||||
const float trans_pitch_rate = M_PI_2_F / math::max(_param_vt_f_trans_dur.get(), 0.1f);
|
||||
|
||||
if (tilt < M_PI_2_F - math::radians(_param_fw_psp_off.get())) {
|
||||
_q_trans_sp = Quatf(AxisAnglef(_trans_rot_axis,
|
||||
@@ -251,7 +252,8 @@ void Tailsitter::update_transition_state()
|
||||
|
||||
} else if (_vtol_schedule.flight_mode == vtol_mode::TRANSITION_BACK) {
|
||||
|
||||
const float trans_pitch_rate = M_PI_2_F / _param_vt_b_trans_dur.get() ;
|
||||
// calculate pitching rate - and constrain to at least 0.1s transition time
|
||||
const float trans_pitch_rate = M_PI_2_F / math::max(_param_vt_b_trans_dur.get(), 0.1f);
|
||||
|
||||
if (!_flag_idle_mc) {
|
||||
_flag_idle_mc = set_idle_mc();
|
||||
|
||||
Reference in New Issue
Block a user