VTOL: add options to set flaps and spoilers in backtransition

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
Silvan Fuhrer
2022-04-27 17:08:36 +02:00
parent f20f207c16
commit 123447bff9
6 changed files with 42 additions and 0 deletions
@@ -323,6 +323,10 @@ void Standard::update_transition_state()
if (!_flag_idle_mc) {
_flag_idle_mc = set_idle_mc();
}
// set spoiler and flaps to the backtransition value
_flaps_setpoint_with_slewrate.update(_params->vt_flaps_bt, _dt);
_spoiler_setpoint_with_slewrate.update(_params->vt_spoilers_bt, _dt);
}
mc_weight = math::constrain(mc_weight, 0.0f, 1.0f);
@@ -446,6 +446,10 @@ void Tiltrotor::update_transition_state()
progress = math::constrain(progress, 0.0f, 1.0f);
_mc_throttle_weight = moveLinear(0.0f, 1.0f, progress);
}
// set spoiler and flaps to the backtransition value
_flaps_setpoint_with_slewrate.update(_params->vt_flaps_bt, _dt);
_spoiler_setpoint_with_slewrate.update(_params->vt_spoilers_bt, _dt);
}
@@ -110,6 +110,9 @@ VtolAttitudeControl::VtolAttitudeControl() :
_params_handles.land_pitch_min_rad = param_find("VT_LND_PTCH_MIN");
_params_handles.vt_spoiler_mc_ld = param_find("VT_SPOILER_MC_LD");
_params_handles.vt_flaps_bt = param_find("VT_FLPAS_BT");
_params_handles.vt_spoilers_bt = param_find("VT_SPOILERS_BT");
/* fetch initial parameter values */
parameters_update();
@@ -374,6 +377,9 @@ VtolAttitudeControl::parameters_update()
param_get(_params_handles.mpc_land_alt2, &_params.mpc_land_alt2);
param_get(_params_handles.vt_spoiler_mc_ld, &_params.vt_spoiler_mc_ld);
param_get(_params_handles.vt_flaps_bt, &_params.vt_flaps_bt);
param_get(_params_handles.vt_spoilers_bt, &_params.vt_spoilers_bt);
// update the parameters of the instances of base VtolType
if (_vtol_type != nullptr) {
_vtol_type->parameters_update();
@@ -252,6 +252,8 @@ private:
param_t mpc_land_alt2;
param_t sys_ctrl_alloc;
param_t vt_spoiler_mc_ld;
param_t vt_flaps_bt;
param_t vt_spoilers_bt;
} _params_handles{};
hrt_abstime _last_run_timestamp{0};
@@ -396,3 +396,27 @@ PARAM_DEFINE_FLOAT(VT_LND_PTCH_MIN, -5.0f);
* @group VTOL Attitude Control
*/
PARAM_DEFINE_FLOAT(VT_SPOILER_MC_LD, 0.f);
/**
* Flaps setting during backtransition
*
* @unit norm
* @min -1
* @max 1
* @decimal 1
* @increment 0.05
* @group VTOL Attitude Control
*/
PARAM_DEFINE_FLOAT(VT_FLAPS_BT, 0.f);
/**
* Spoiler setting during backtransition
*
* @unit norm
* @min -1
* @max 1
* @decimal 1
* @increment 0.05
* @group VTOL Attitude Control
*/
PARAM_DEFINE_FLOAT(VT_SPOILERS_BT, 0.f);
+2
View File
@@ -86,6 +86,8 @@ struct Params {
float mpc_land_alt1;
float mpc_land_alt2;
float vt_spoiler_mc_ld;
float vt_flaps_bt;
float vt_spoilers_bt;
};
// Has to match 1:1 msg/vtol_vehicle_status.msg