mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-02 03:49:12 +08:00
VTOL backtransition improvements
* vtol_type: only allow positive pitch setpoints during backtransition * vtol params: set default of VT_B_DEC_FF to 0, as for most frames a FF is not necessary * Tiltrotor: fix throttle during first part of back transition * Tiltrotor: only enable all motors in second phase of backtransition (tilting phase) Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
@@ -380,8 +380,6 @@ void Tiltrotor::update_transition_state()
|
|||||||
_v_att_sp->thrust_body[0] = _thrust_transition;
|
_v_att_sp->thrust_body[0] = _thrust_transition;
|
||||||
|
|
||||||
} else if (_vtol_schedule.flight_mode == vtol_mode::TRANSITION_BACK) {
|
} else if (_vtol_schedule.flight_mode == vtol_mode::TRANSITION_BACK) {
|
||||||
// turn on all MC motors
|
|
||||||
set_all_motor_state(motor_state::ENABLED);
|
|
||||||
|
|
||||||
// set idle speed for rotary wing mode
|
// set idle speed for rotary wing mode
|
||||||
if (!_flag_idle_mc) {
|
if (!_flag_idle_mc) {
|
||||||
@@ -403,13 +401,18 @@ void Tiltrotor::update_transition_state()
|
|||||||
_v_att_sp->pitch_body = update_and_get_backtransition_pitch_sp();
|
_v_att_sp->pitch_body = update_and_get_backtransition_pitch_sp();
|
||||||
}
|
}
|
||||||
|
|
||||||
// while we quickly rotate back the motors keep throttle at idle
|
|
||||||
if (time_since_trans_start < BACKTRANS_THROTTLE_DOWNRAMP_DUR_S) {
|
if (time_since_trans_start < BACKTRANS_THROTTLE_DOWNRAMP_DUR_S) {
|
||||||
|
// blend throttle from FW value to 0
|
||||||
_mc_throttle_weight = 1.0f;
|
_mc_throttle_weight = 1.0f;
|
||||||
const float target_throttle = 0.0f;
|
const float target_throttle = 0.0f;
|
||||||
blendThrottleDuringBacktransition(time_since_trans_start, target_throttle);
|
const float progress = time_since_trans_start / BACKTRANS_THROTTLE_DOWNRAMP_DUR_S;
|
||||||
|
blendThrottleDuringBacktransition(progress, target_throttle);
|
||||||
|
|
||||||
} else if (time_since_trans_start < timeUntilMotorsAreUp()) {
|
} else if (time_since_trans_start < timeUntilMotorsAreUp()) {
|
||||||
|
// while we quickly rotate back the motors keep throttle at idle
|
||||||
|
|
||||||
|
// turn on all MC motors
|
||||||
|
set_all_motor_state(motor_state::ENABLED);
|
||||||
_mc_throttle_weight = 0.0f;
|
_mc_throttle_weight = 0.0f;
|
||||||
_mc_roll_weight = 0.0f;
|
_mc_roll_weight = 0.0f;
|
||||||
_mc_pitch_weight = 0.0f;
|
_mc_pitch_weight = 0.0f;
|
||||||
@@ -511,7 +514,7 @@ void Tiltrotor::blendThrottleAfterFrontTransition(float scale)
|
|||||||
|
|
||||||
void Tiltrotor::blendThrottleDuringBacktransition(float scale, float target_throttle)
|
void Tiltrotor::blendThrottleDuringBacktransition(float scale, float target_throttle)
|
||||||
{
|
{
|
||||||
_v_att_sp->thrust_body[2] = -(scale * target_throttle + (1.0f - scale) * _last_thr_in_fw_mode);
|
_thrust_transition = -(scale * target_throttle + (1.0f - scale) * _last_thr_in_fw_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -329,10 +329,10 @@ PARAM_DEFINE_FLOAT(VT_FW_DIFTHR_SC, 0.1f);
|
|||||||
* @min 0
|
* @min 0
|
||||||
* @max 0.2
|
* @max 0.2
|
||||||
* @decimal 1
|
* @decimal 1
|
||||||
* @increment 0.05
|
* @increment 0.01
|
||||||
* @group VTOL Attitude Control
|
* @group VTOL Attitude Control
|
||||||
*/
|
*/
|
||||||
PARAM_DEFINE_FLOAT(VT_B_DEC_FF, 0.12f);
|
PARAM_DEFINE_FLOAT(VT_B_DEC_FF, 0.f);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Backtransition deceleration setpoint to pitch I gain.
|
* Backtransition deceleration setpoint to pitch I gain.
|
||||||
|
|||||||
@@ -231,14 +231,14 @@ float VtolType::update_and_get_backtransition_pitch_sp()
|
|||||||
float integrator_input = _params->dec_to_pitch_i * accel_error_forward;
|
float integrator_input = _params->dec_to_pitch_i * accel_error_forward;
|
||||||
|
|
||||||
if ((pitch_sp_new >= pitch_lim && accel_error_forward > 0.0f) ||
|
if ((pitch_sp_new >= pitch_lim && accel_error_forward > 0.0f) ||
|
||||||
(pitch_sp_new <= -pitch_lim && accel_error_forward < 0.0f)) {
|
(pitch_sp_new <= 0.f && accel_error_forward < 0.0f)) {
|
||||||
integrator_input = 0.0f;
|
integrator_input = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
_accel_to_pitch_integ += integrator_input * _transition_dt;
|
_accel_to_pitch_integ += integrator_input * _transition_dt;
|
||||||
|
|
||||||
|
// only allow positive (pitch up) pitch setpoint
|
||||||
return math::constrain(pitch_sp_new, -pitch_lim, pitch_lim);
|
return math::constrain(pitch_sp_new, 0.f, pitch_lim);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VtolType::can_transition_on_ground()
|
bool VtolType::can_transition_on_ground()
|
||||||
|
|||||||
Reference in New Issue
Block a user