add option to lock elevons for tailsitters in mc mode

This commit is contained in:
tumbili 2015-06-19 09:46:40 +02:00
parent aade901ef0
commit 60857c7940
6 changed files with 26 additions and 14 deletions

View File

@ -178,7 +178,12 @@ void Tailsitter::fill_mc_att_control_output()
_actuators_out_0->control[1] = _actuators_mc_in->control[1]; _actuators_out_0->control[1] = _actuators_mc_in->control[1];
_actuators_out_0->control[2] = _actuators_mc_in->control[2]; _actuators_out_0->control[2] = _actuators_mc_in->control[2];
_actuators_out_0->control[3] = _actuators_mc_in->control[3]; _actuators_out_0->control[3] = _actuators_mc_in->control[3];
//set neutral position for elevons
if (_params->elevons_mc_lock == 1) {
_actuators_out_1->control[0] = 0;
_actuators_out_1->control[1] = 0;
} else {
_actuators_out_1->control[0] = _actuators_mc_in->control[2]; //roll elevon _actuators_out_1->control[0] = _actuators_mc_in->control[2]; //roll elevon
_actuators_out_1->control[1] = _actuators_mc_in->control[1]; //pitch elevon _actuators_out_1->control[1] = _actuators_mc_in->control[1]; //pitch elevon
}
} }

View File

@ -105,14 +105,3 @@ PARAM_DEFINE_FLOAT(VT_TILT_FW,1.0f);
* @group VTOL Attitude Control * @group VTOL Attitude Control
*/ */
PARAM_DEFINE_FLOAT(VT_ARSP_TRANS,10.0f); PARAM_DEFINE_FLOAT(VT_ARSP_TRANS,10.0f);
/**
* Lock elevons in multicopter mode
*
* If set to 1 the elevons are locked in multicopter mode
*
* @min 0
* @max 1
* @group VTOL Attitude Control
*/
PARAM_DEFINE_INT32(VT_ELEV_MC_LOCK,0);

View File

@ -111,6 +111,7 @@ VtolAttitudeControl::VtolAttitudeControl() :
_params_handles.prop_eff = param_find("VT_PROP_EFF"); _params_handles.prop_eff = param_find("VT_PROP_EFF");
_params_handles.arsp_lp_gain = param_find("VT_ARSP_LP_GAIN"); _params_handles.arsp_lp_gain = param_find("VT_ARSP_LP_GAIN");
_params_handles.vtol_type = param_find("VT_TYPE"); _params_handles.vtol_type = param_find("VT_TYPE");
_params_handles.elevons_mc_lock = param_find("VT_ELEV_MC_LOCK");
/* fetch initial parameter values */ /* fetch initial parameter values */
parameters_update(); parameters_update();
@ -356,6 +357,10 @@ VtolAttitudeControl::parameters_update()
param_get(_params_handles.vtol_type, &l); param_get(_params_handles.vtol_type, &l);
_params.vtol_type = l; _params.vtol_type = l;
/* vtol lock elevons in multicopter */
param_get(_params_handles.elevons_mc_lock, &l);
_params.elevons_mc_lock = l;
return OK; return OK;
} }

View File

@ -176,6 +176,7 @@ private:
param_t prop_eff; param_t prop_eff;
param_t arsp_lp_gain; param_t arsp_lp_gain;
param_t vtol_type; param_t vtol_type;
param_t elevons_mc_lock;
} _params_handles; } _params_handles;
/* for multicopters it is usual to have a non-zero idle speed of the engines /* for multicopters it is usual to have a non-zero idle speed of the engines

View File

@ -150,3 +150,14 @@ PARAM_DEFINE_FLOAT(VT_ARSP_LP_GAIN,0.3f);
* @group VTOL Attitude Control * @group VTOL Attitude Control
*/ */
PARAM_DEFINE_INT32(VT_TYPE, 0); PARAM_DEFINE_INT32(VT_TYPE, 0);
/**
* Lock elevons in multicopter mode
*
* If set to 1 the elevons are locked in multicopter mode
*
* @min 0
* @max 1
* @group VTOL Attitude Control
*/
PARAM_DEFINE_INT32(VT_ELEV_MC_LOCK,0);

View File

@ -53,6 +53,7 @@ struct Params {
float prop_eff; // factor to calculate prop efficiency float prop_eff; // factor to calculate prop efficiency
float arsp_lp_gain; // total airspeed estimate low pass gain float arsp_lp_gain; // total airspeed estimate low pass gain
int vtol_type; int vtol_type;
int elevons_mc_lock; // lock elevons in multicopter mode
}; };
enum mode { enum mode {