Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VTOL standard: introduce scale for FW control surfaces in hover #12946

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/modules/vtol_att_control/standard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions src/modules/vtol_att_control/standard.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
22 changes: 22 additions & 0 deletions src/modules/vtol_att_control/standard_params.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);