mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
tiltrotor back-transition improvements:
- do not set zero throttle during the entire back-transition because otherwise we need to make the back-transition really short - added ramping up of throttle setpoint during backtransition to avoid step inputs - back-transition ends after back-transition time and not when motors are fully rotated updwards. previously the vehicle would enter hover mode at high speed which was not handled well by the mc position controller Signed-off-by: Roman <bapstroman@gmail.com>
This commit is contained in:
parent
c642025339
commit
deed462e62
@ -124,7 +124,9 @@ void Tiltrotor::update_vtol_state()
|
||||
break;
|
||||
|
||||
case TRANSITION_BACK:
|
||||
if (_tilt_control <= _params_tiltrotor.tilt_mc) {
|
||||
float time_since_trans_start = (float)(hrt_absolute_time() - _vtol_schedule.transition_start) * 1e-6f;
|
||||
|
||||
if (_tilt_control <= _params_tiltrotor.tilt_mc && time_since_trans_start > _params->back_trans_duration) {
|
||||
_vtol_schedule.flight_mode = MC_MODE;
|
||||
}
|
||||
|
||||
@ -303,18 +305,28 @@ void Tiltrotor::update_transition_state()
|
||||
// tilt rotors back
|
||||
if (_tilt_control > _params_tiltrotor.tilt_mc) {
|
||||
_tilt_control = _params_tiltrotor.tilt_fw -
|
||||
fabsf(_params_tiltrotor.tilt_fw - _params_tiltrotor.tilt_mc) * time_since_trans_start / _params->back_trans_duration;
|
||||
fabsf(_params_tiltrotor.tilt_fw - _params_tiltrotor.tilt_mc) * time_since_trans_start / 1.0f;
|
||||
}
|
||||
|
||||
// set zero throttle for backtransition otherwise unwanted moments will be created
|
||||
_actuators_mc_in->control[actuator_controls_s::INDEX_THROTTLE] = 0.0f;
|
||||
_mc_yaw_weight = 1.0f;
|
||||
|
||||
_mc_roll_weight = 0.0f;
|
||||
// while we quickly rotate back the motors keep throttle at idle
|
||||
if (time_since_trans_start < 1.0f) {
|
||||
_mc_throttle_weight = 0.0f;
|
||||
_mc_roll_weight = 0.0f;
|
||||
_mc_pitch_weight = 0.0f;
|
||||
|
||||
} else {
|
||||
_mc_roll_weight = 1.0f;
|
||||
_mc_pitch_weight = 1.0f;
|
||||
// slowly ramp up throttle to avoid step inputs
|
||||
_mc_throttle_weight = (time_since_trans_start - 1.0f) / 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
_mc_roll_weight = math::constrain(_mc_roll_weight, 0.0f, 1.0f);
|
||||
_mc_yaw_weight = math::constrain(_mc_yaw_weight, 0.0f, 1.0f);
|
||||
_mc_throttle_weight = math::constrain(_mc_throttle_weight, 0.0f, 1.0f);
|
||||
|
||||
// copy virtual attitude setpoint to real attitude setpoint (we use multicopter att sp)
|
||||
memcpy(_v_att_sp, _mc_virtual_att_sp, sizeof(vehicle_attitude_setpoint_s));
|
||||
@ -353,7 +365,7 @@ void Tiltrotor::fill_actuator_outputs()
|
||||
|
||||
} else {
|
||||
_actuators_out_0->control[actuator_controls_s::INDEX_THROTTLE] =
|
||||
_actuators_mc_in->control[actuator_controls_s::INDEX_THROTTLE];
|
||||
_actuators_mc_in->control[actuator_controls_s::INDEX_THROTTLE] * _mc_throttle_weight;
|
||||
}
|
||||
|
||||
_actuators_out_1->timestamp = hrt_absolute_time();
|
||||
|
||||
@ -124,6 +124,7 @@ void VtolType::update_mc_state()
|
||||
_mc_roll_weight = 1.0f;
|
||||
_mc_pitch_weight = 1.0f;
|
||||
_mc_yaw_weight = 1.0f;
|
||||
_mc_throttle_weight = 1.0f;
|
||||
}
|
||||
|
||||
void VtolType::update_fw_state()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user