mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 14:43:33 +08:00
VTOL rate control architecture improvements (#10819)
* attitude and rate setpoint message: use 3D array for thrust demand * FixedWingAttitudeControl: rework airspeed scaling * move airspeed and scaling calculation into separate method * if vtol in hover and airspeed disabled use minimum airspeed instead of trim airspeed
This commit is contained in:
@@ -45,8 +45,7 @@
|
||||
#define ARSP_YAW_CTRL_DISABLE 7.0f // airspeed at which we stop controlling yaw during a front transition
|
||||
|
||||
Tiltrotor::Tiltrotor(VtolAttitudeControl *attc) :
|
||||
VtolType(attc),
|
||||
_tilt_control(0.0f)
|
||||
VtolType(attc)
|
||||
{
|
||||
_vtol_schedule.flight_mode = MC_MODE;
|
||||
_vtol_schedule.transition_start = 0;
|
||||
@@ -61,8 +60,6 @@ Tiltrotor::Tiltrotor(VtolAttitudeControl *attc) :
|
||||
_params_handles_tiltrotor.tilt_transition = param_find("VT_TILT_TRANS");
|
||||
_params_handles_tiltrotor.tilt_fw = param_find("VT_TILT_FW");
|
||||
_params_handles_tiltrotor.front_trans_dur_p2 = param_find("VT_TRANS_P2_DUR");
|
||||
_params_handles_tiltrotor.diff_thrust = param_find("VT_FW_DIFTHR_EN");
|
||||
_params_handles_tiltrotor.diff_thrust_scale = param_find("VT_FW_DIFTHR_SC");
|
||||
}
|
||||
|
||||
void
|
||||
@@ -85,16 +82,10 @@ Tiltrotor::parameters_update()
|
||||
/* vtol front transition phase 2 duration */
|
||||
param_get(_params_handles_tiltrotor.front_trans_dur_p2, &v);
|
||||
_params_tiltrotor.front_trans_dur_p2 = v;
|
||||
|
||||
param_get(_params_handles_tiltrotor.diff_thrust, &_params_tiltrotor.diff_thrust);
|
||||
|
||||
param_get(_params_handles_tiltrotor.diff_thrust_scale, &v);
|
||||
_params_tiltrotor.diff_thrust_scale = math::constrain(v, -1.0f, 1.0f);
|
||||
}
|
||||
|
||||
void Tiltrotor::update_vtol_state()
|
||||
{
|
||||
|
||||
/* simple logic using a two way switch to perform transitions.
|
||||
* after flipping the switch the vehicle will start tilting rotors, picking up
|
||||
* forward speed. After the vehicle has picked up enough speed the rotors are tilted
|
||||
@@ -270,7 +261,7 @@ void Tiltrotor::update_transition_state()
|
||||
_mc_yaw_weight = _mc_roll_weight;
|
||||
}
|
||||
|
||||
_thrust_transition = _mc_virtual_att_sp->thrust;
|
||||
_thrust_transition = -_mc_virtual_att_sp->thrust_body[2];
|
||||
|
||||
} else if (_vtol_schedule.flight_mode == TRANSITION_FRONT_P2) {
|
||||
// the plane is ready to go into fixed wing mode, tilt the rotors forward completely
|
||||
@@ -289,7 +280,7 @@ void Tiltrotor::update_transition_state()
|
||||
_motor_state = set_motor_state(_motor_state, VALUE, rear_value);
|
||||
|
||||
|
||||
_thrust_transition = _mc_virtual_att_sp->thrust;
|
||||
_thrust_transition = -_mc_virtual_att_sp->thrust_body[2];
|
||||
|
||||
} else if (_vtol_schedule.flight_mode == TRANSITION_BACK) {
|
||||
if (_motor_state != ENABLED) {
|
||||
@@ -335,7 +326,7 @@ void Tiltrotor::update_transition_state()
|
||||
void Tiltrotor::waiting_on_tecs()
|
||||
{
|
||||
// keep multicopter thrust until we get data from TECS
|
||||
_v_att_sp->thrust = _thrust_transition;
|
||||
_v_att_sp->thrust_body[0] = _thrust_transition;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -358,9 +349,9 @@ void Tiltrotor::fill_actuator_outputs()
|
||||
_actuators_fw_in->control[actuator_controls_s::INDEX_THROTTLE];
|
||||
|
||||
/* allow differential thrust if enabled */
|
||||
if (_params_tiltrotor.diff_thrust == 1) {
|
||||
if (_params->diff_thrust == 1) {
|
||||
_actuators_out_0->control[actuator_controls_s::INDEX_ROLL] =
|
||||
_actuators_fw_in->control[actuator_controls_s::INDEX_YAW] * _params_tiltrotor.diff_thrust_scale;
|
||||
_actuators_fw_in->control[actuator_controls_s::INDEX_YAW] * _params->diff_thrust_scale;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user