From 60857c7940d13af7d0168e7950a9799d30c3bb68 Mon Sep 17 00:00:00 2001 From: tumbili Date: Fri, 19 Jun 2015 09:46:40 +0200 Subject: [PATCH 1/2] add option to lock elevons for tailsitters in mc mode --- src/modules/vtol_att_control/tailsitter.cpp | 11 ++++++++--- src/modules/vtol_att_control/tiltrotor_params.c | 11 ----------- .../vtol_att_control/vtol_att_control_main.cpp | 5 +++++ src/modules/vtol_att_control/vtol_att_control_main.h | 1 + .../vtol_att_control/vtol_att_control_params.c | 11 +++++++++++ src/modules/vtol_att_control/vtol_type.h | 1 + 6 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/modules/vtol_att_control/tailsitter.cpp b/src/modules/vtol_att_control/tailsitter.cpp index 4479783b92..358f636561 100644 --- a/src/modules/vtol_att_control/tailsitter.cpp +++ b/src/modules/vtol_att_control/tailsitter.cpp @@ -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[2] = _actuators_mc_in->control[2]; _actuators_out_0->control[3] = _actuators_mc_in->control[3]; - //set neutral position for elevons - _actuators_out_1->control[0] = _actuators_mc_in->control[2]; //roll elevon - _actuators_out_1->control[1] = _actuators_mc_in->control[1]; //pitch elevon + + 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[1] = _actuators_mc_in->control[1]; //pitch elevon + } } diff --git a/src/modules/vtol_att_control/tiltrotor_params.c b/src/modules/vtol_att_control/tiltrotor_params.c index 76f3ee6c3c..7d233f6f50 100644 --- a/src/modules/vtol_att_control/tiltrotor_params.c +++ b/src/modules/vtol_att_control/tiltrotor_params.c @@ -105,14 +105,3 @@ PARAM_DEFINE_FLOAT(VT_TILT_FW,1.0f); * @group VTOL Attitude Control */ 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); diff --git a/src/modules/vtol_att_control/vtol_att_control_main.cpp b/src/modules/vtol_att_control/vtol_att_control_main.cpp index a565c618e3..b70cd19dd8 100644 --- a/src/modules/vtol_att_control/vtol_att_control_main.cpp +++ b/src/modules/vtol_att_control/vtol_att_control_main.cpp @@ -111,6 +111,7 @@ VtolAttitudeControl::VtolAttitudeControl() : _params_handles.prop_eff = param_find("VT_PROP_EFF"); _params_handles.arsp_lp_gain = param_find("VT_ARSP_LP_GAIN"); _params_handles.vtol_type = param_find("VT_TYPE"); + _params_handles.elevons_mc_lock = param_find("VT_ELEV_MC_LOCK"); /* fetch initial parameter values */ parameters_update(); @@ -356,6 +357,10 @@ VtolAttitudeControl::parameters_update() param_get(_params_handles.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; } diff --git a/src/modules/vtol_att_control/vtol_att_control_main.h b/src/modules/vtol_att_control/vtol_att_control_main.h index 2772f9bcb1..43e8969929 100644 --- a/src/modules/vtol_att_control/vtol_att_control_main.h +++ b/src/modules/vtol_att_control/vtol_att_control_main.h @@ -176,6 +176,7 @@ private: param_t prop_eff; param_t arsp_lp_gain; param_t vtol_type; + param_t elevons_mc_lock; } _params_handles; /* for multicopters it is usual to have a non-zero idle speed of the engines diff --git a/src/modules/vtol_att_control/vtol_att_control_params.c b/src/modules/vtol_att_control/vtol_att_control_params.c index 429d44c46c..f302314a23 100644 --- a/src/modules/vtol_att_control/vtol_att_control_params.c +++ b/src/modules/vtol_att_control/vtol_att_control_params.c @@ -150,3 +150,14 @@ PARAM_DEFINE_FLOAT(VT_ARSP_LP_GAIN,0.3f); * @group VTOL Attitude Control */ 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); diff --git a/src/modules/vtol_att_control/vtol_type.h b/src/modules/vtol_att_control/vtol_type.h index 57448a7587..bbe6a8642e 100644 --- a/src/modules/vtol_att_control/vtol_type.h +++ b/src/modules/vtol_att_control/vtol_type.h @@ -53,6 +53,7 @@ struct Params { float prop_eff; // factor to calculate prop efficiency float arsp_lp_gain; // total airspeed estimate low pass gain int vtol_type; + int elevons_mc_lock; // lock elevons in multicopter mode }; enum mode { From fc7dc297fc168465456b868cfd5cef26174f76d6 Mon Sep 17 00:00:00 2001 From: tumbili Date: Fri, 19 Jun 2015 09:48:07 +0200 Subject: [PATCH 2/2] lock elevons in mc mode for tailsitter with motors in x config --- ROMFS/px4fmu_common/init.d/13003_quad_tailsitter | 1 + 1 file changed, 1 insertion(+) diff --git a/ROMFS/px4fmu_common/init.d/13003_quad_tailsitter b/ROMFS/px4fmu_common/init.d/13003_quad_tailsitter index daad3d9351..17560526a3 100644 --- a/ROMFS/px4fmu_common/init.d/13003_quad_tailsitter +++ b/ROMFS/px4fmu_common/init.d/13003_quad_tailsitter @@ -15,3 +15,4 @@ set MAV_TYPE 20 param set VT_MOT_COUNT 4 param set VT_IDLE_PWM_MC 1080 param set VT_TYPE 0 +param set VT_ELEV_MC_LOCK 1