diff --git a/src/modules/vtol_att_control/standard.cpp b/src/modules/vtol_att_control/standard.cpp index 8bcf9a0c5f61..b2ad22eced33 100644 --- a/src/modules/vtol_att_control/standard.cpp +++ b/src/modules/vtol_att_control/standard.cpp @@ -67,6 +67,9 @@ Standard::Standard(VtolAttitudeControl *attc) : _params_handles_standard.pitch_setpoint_offset = param_find("FW_PSP_OFF"); _params_handles_standard.reverse_output = param_find("VT_B_REV_OUT"); _params_handles_standard.reverse_delay = param_find("VT_B_REV_DEL"); + + _params_handles_standard.mc_to_fw_gain_roll = param_find("VT_MC_AILE_GAIN"); + _params_handles_standard.mc_to_fw_gain_pitch = param_find("VT_MC_ELEV_GAIN"); } void @@ -103,6 +106,12 @@ Standard::parameters_update() param_get(_params_handles_standard.reverse_delay, &v); _params_standard.reverse_delay = math::constrain(v, 0.0f, 10.0f); + param_get(_params_handles_standard.mc_to_fw_gain_roll, &v); + _params_standard.mc_to_fw_gain_roll = math::constrain(v, 0.0f, 10.0f); + + param_get(_params_handles_standard.mc_to_fw_gain_pitch, &v); + _params_standard.mc_to_fw_gain_pitch = math::constrain(v, 0.0f, 10.0f); + } void Standard::update_vtol_state() @@ -442,11 +451,11 @@ void Standard::fill_actuator_outputs() } else { // roll _actuators_out_1->control[actuator_controls_s::INDEX_ROLL] = - _actuators_fw_in->control[actuator_controls_s::INDEX_ROLL]; + _actuators_fw_in->control[actuator_controls_s::INDEX_ROLL] * _params_standard.mc_to_fw_gain_roll; // pitch _actuators_out_1->control[actuator_controls_s::INDEX_PITCH] = - _actuators_fw_in->control[actuator_controls_s::INDEX_PITCH]; + _actuators_fw_in->control[actuator_controls_s::INDEX_PITCH] * _params_standard.mc_to_fw_gain_pitch; _actuators_out_1->control[actuator_controls_s::INDEX_YAW] = 0.0f; _actuators_out_1->control[actuator_controls_s::INDEX_AIRBRAKES] = 0.0f; diff --git a/src/modules/vtol_att_control/standard.h b/src/modules/vtol_att_control/standard.h index da623cfc30b5..3bf456de2990 100644 --- a/src/modules/vtol_att_control/standard.h +++ b/src/modules/vtol_att_control/standard.h @@ -74,6 +74,8 @@ class Standard : public VtolType float pitch_setpoint_offset; float reverse_output; float reverse_delay; + float mc_to_fw_gain_roll; + float mc_to_fw_gain_pitch; } _params_standard; struct { @@ -84,6 +86,8 @@ class Standard : public VtolType param_t pitch_setpoint_offset; param_t reverse_output; param_t reverse_delay; + param_t mc_to_fw_gain_roll; + param_t mc_to_fw_gain_pitch; } _params_handles_standard; enum class vtol_mode { diff --git a/src/modules/vtol_att_control/standard_params.c b/src/modules/vtol_att_control/standard_params.c index 1427e5a07112..69d52eb8477e 100644 --- a/src/modules/vtol_att_control/standard_params.c +++ b/src/modules/vtol_att_control/standard_params.c @@ -112,3 +112,25 @@ PARAM_DEFINE_FLOAT(VT_B_REV_DEL, 0.0f); * @group VTOL Attitude Control */ PARAM_DEFINE_FLOAT(VT_PSHER_RMP_DT, 3.0f); + +/** + * Roll scale on fixed-wing actuators in hover. + * + * Determines how much the roll controlling surfaces (e.g. ailerons or elevons) are used to assist the multicopter motors in hover. + * + * @min 0 + * @max 3 + * @group VTOL Attitude Control + */ +PARAM_DEFINE_FLOAT(VT_MC_AILE_GAIN, 1.0f); + +/** + * Pitch scale on fixed-wing actuators in hover. + * + * Determines how much the pitch controlling surfaces (e.g. elevator or elevons) are used to assist the multicopter motors in hover. + * + * @min 0 + * @max 3 + * @group VTOL Attitude Control + */ +PARAM_DEFINE_FLOAT(VT_MC_ELEV_GAIN, 1.0f);