forked from Archive/PX4-Autopilot
tiltrotor: allow to finish transition if groundspeed is below cruise speed
Signed-off-by: RomanBapst <bapstroman@gmail.com>
This commit is contained in:
parent
842d98d572
commit
fd18ba6496
|
@ -123,9 +123,12 @@ void Tiltrotor::update_vtol_state()
|
|||
break;
|
||||
|
||||
case vtol_mode::TRANSITION_BACK:
|
||||
float time_since_trans_start = (float)(hrt_absolute_time() - _vtol_schedule.transition_start) * 1e-6f;
|
||||
const float time_since_trans_start = (float)(hrt_absolute_time() - _vtol_schedule.transition_start) * 1e-6f;
|
||||
const float ground_speed = sqrtf(_local_pos->vx * _local_pos->vx + _local_pos->vy * _local_pos->vy);
|
||||
const bool ground_speed_below_cruise = _local_pos->v_xy_valid && (ground_speed <= _params->mpc_xy_cruise);
|
||||
|
||||
if (_tilt_control <= _params_tiltrotor.tilt_mc && time_since_trans_start > _params->back_trans_duration) {
|
||||
if (_tilt_control <= _params_tiltrotor.tilt_mc && (time_since_trans_start > _params->back_trans_duration
|
||||
|| ground_speed_below_cruise)) {
|
||||
_vtol_schedule.flight_mode = vtol_mode::MC_MODE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue