From b9fab04adbfd92783206a08364c8fea077f1ed39 Mon Sep 17 00:00:00 2001 From: Silvan Fuhrer Date: Fri, 14 Feb 2020 10:50:24 +0100 Subject: [PATCH] tiltrotor: improve comments and renaming of one variable This is to point out that also rear motor can be used in FW flight and not only the front motors Signed-off-by: Silvan Fuhrer --- src/modules/vtol_att_control/tiltrotor.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/modules/vtol_att_control/tiltrotor.cpp b/src/modules/vtol_att_control/tiltrotor.cpp index 59a5b50aa4..a361c050fa 100644 --- a/src/modules/vtol_att_control/tiltrotor.cpp +++ b/src/modules/vtol_att_control/tiltrotor.cpp @@ -232,7 +232,7 @@ void Tiltrotor::update_transition_state() } if (_vtol_schedule.flight_mode == vtol_mode::TRANSITION_FRONT_P1) { - // for the first part of the transition the rear rotors are enabled + // for the first part of the transition all rotors are enabled if (_motor_state != motor_state::ENABLED) { _motor_state = set_motor_state(_motor_state, motor_state::ENABLED); } @@ -280,17 +280,18 @@ void Tiltrotor::update_transition_state() _mc_roll_weight = 0.0f; _mc_yaw_weight = 0.0f; - // ramp down rear motors (setting MAX_PWM down scales the given output into the new range) - int rear_value = (1.0f - time_since_trans_start / _params_tiltrotor.front_trans_dur_p2) * - (PWM_DEFAULT_MAX - PWM_DEFAULT_MIN) + PWM_DEFAULT_MIN; + // ramp down motors not used in fixed-wing flight (setting MAX_PWM down scales the given output into the new range) + int ramp_down_value = (1.0f - time_since_trans_start / _params_tiltrotor.front_trans_dur_p2) * + (PWM_DEFAULT_MAX - PWM_DEFAULT_MIN) + PWM_DEFAULT_MIN; - _motor_state = set_motor_state(_motor_state, motor_state::VALUE, rear_value); + _motor_state = set_motor_state(_motor_state, motor_state::VALUE, ramp_down_value); _thrust_transition = -_mc_virtual_att_sp->thrust_body[2]; } else if (_vtol_schedule.flight_mode == vtol_mode::TRANSITION_BACK) { + // turn on all MC motors if (_motor_state != motor_state::ENABLED) { _motor_state = set_motor_state(_motor_state, motor_state::ENABLED); }