fix(vtol): restart the tiltrotor front transition mid back transition (#29609)

* fix(vtol): restart the tiltrotor front transition mid back transition

A tiltrotor that got a fixed-wing request while still transitioning
back to hover switched straight to fixed-wing mode, which commands full
forward tilt in one step and starts the throttle blend from the hover
thrust on the front rotors, even with the rotors already part way to
vertical and the motors off. In Gazebo that can pitch the aircraft up
50 degrees and stall it. Keep the instant switch while the rotors are
still forward of VT_TILT_TRANS and otherwise restart the front
transition from the current tilt, as the standard VTOL does. The first
front transition phase sets the pitch weight and ramps the throttle
weight back up, since the back transition zeroes both while the rotors
rotate.

Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>
This commit is contained in:
Saibernard authored and GitHub committed 2026-11-09 09:09:31 +01:00
1 parent d83b4e7df9
commit cdf9cfb28b
1 file changed
+16 -3
+16 -3
View File
@@ -150,8 +150,18 @@ void Tiltrotor::update_vtol_state()
break;
case vtol_mode::TRANSITION_BACK:
// failsafe into fixed wing mode
_vtol_mode = vtol_mode::FW_MODE;
// while the rotors are still tilted forward enough for the wing, finish as before
if (_tilt_control >= _param_vt_tilt_trans.get()) {
_vtol_mode = vtol_mode::FW_MODE;
} else {
// the rotors are already coming back. Restart the front transition from the current tilt
// instead of handing the fixed-wing controller a vehicle with the rotors near vertical
resetTransitionStates();
_vtol_mode = vtol_mode::TRANSITION_FRONT_P1;
}
break;
}
}
@@ -247,9 +257,12 @@ void Tiltrotor::update_transition_state()
_tilt_control = math::max(_tilt_control, ramped_up_tilt);
}
// at low speeds give full weight to MC
// at low speeds give full weight to MC. A back transition zeroes the pitch and throttle weights
// while the rotors rotate, so a restarted front transition sets pitch and ramps the throttle back
_mc_roll_weight = 1.0f;
_mc_pitch_weight = 1.0f;
_mc_yaw_weight = 1.0f;
_mc_throttle_weight = math::min(_mc_throttle_weight + _transition_dt / BACKTRANS_THROTTLE_UPRAMP_DUR_S, 1.0f);
const float airspeed_trans_blend_margin = getTransitionAirspeed() - getBlendAirspeed();