tiltrotor: only allow increasing tilt during first part of transition

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
Silvan Fuhrer 2021-04-23 09:35:12 +02:00 committed by Daniel Agar
parent fa9fdce6e6
commit 3c4b0c1b8c
1 changed files with 6 additions and 4 deletions

View File

@ -299,11 +299,13 @@ void Tiltrotor::update_transition_state()
// tilt rotors forward up to certain angle
if (_tilt_control <= _params_tiltrotor.tilt_transition) {
_tilt_control = _params_tiltrotor.tilt_mc +
fabsf(_params_tiltrotor.tilt_transition - _params_tiltrotor.tilt_mc) * time_since_trans_start /
_params->front_trans_duration;
}
const float ramped_up_tilt = _params_tiltrotor.tilt_mc +
fabsf(_params_tiltrotor.tilt_transition - _params_tiltrotor.tilt_mc) *
time_since_trans_start / _params->front_trans_duration;
// only allow increasing tilt (tilt in hover can already be non-zero)
_tilt_control = math::max(_tilt_control, ramped_up_tilt);
}
// at low speeds give full weight to MC
_mc_roll_weight = 1.0f;