added parameter to allow scaling the forward thrust used to acclerate forward

in multirotor mode
This commit is contained in:
tumbili 2016-03-29 10:38:02 +02:00 committed by tumbili
parent 34fe340864
commit db2a53d95d
3 changed files with 20 additions and 1 deletions

View File

@ -67,6 +67,7 @@ Standard::Standard(VtolAttitudeControl *attc) :
_params_handles_standard.front_trans_timeout = param_find("VT_TRANS_TIMEOUT");
_params_handles_standard.front_trans_time_min = param_find("VT_TRANS_MIN_TM");
_params_handles_standard.down_pitch_max = param_find("VT_DWN_PITCH_MAX");
_params_handles_standard.forward_thurst_scale = param_find("VT_FWD_THRUST_SC");
}
Standard::~Standard()
@ -110,6 +111,10 @@ Standard::parameters_update()
param_get(_params_handles_standard.down_pitch_max, &v);
_params_standard.down_pitch_max = math::radians(v);
/* scale for fixed wing thrust used for forward acceleration in multirotor mode */
param_get(_params_handles_standard.forward_thurst_scale, &_params_standard.forward_thurst_scale);
return OK;
}
@ -297,7 +302,8 @@ void Standard::update_mc_state()
R.from_euler(0, 0, euler(2));
math::Vector<3> body_x_zero_tilt(R(0,0), R(1,0), R(2,0));
_pusher_throttle = body_x_zero_tilt * thrust_sp_axis * _v_att_sp->thrust;
// we are using a parameter to scale the thrust value in order to compensate for highly over/under-powered motors
_pusher_throttle = body_x_zero_tilt * thrust_sp_axis * _v_att_sp->thrust * _params_standard.forward_thurst_scale;
_pusher_throttle = _pusher_throttle < 0.0f ? 0.0f : _pusher_throttle;
float pitch_sp_corrected = _v_att_sp->pitch_body < -_params_standard.down_pitch_max ? -_params_standard.down_pitch_max : _v_att_sp->pitch_body;

View File

@ -75,6 +75,7 @@ private:
float front_trans_timeout;
float front_trans_time_min;
float down_pitch_max;
float forward_thurst_scale;
} _params_standard;
struct {
@ -86,6 +87,7 @@ private:
param_t front_trans_timeout;
param_t front_trans_time_min;
param_t down_pitch_max;
param_t forward_thurst_scale;
} _params_handles_standard;
enum vtol_mode {

View File

@ -60,3 +60,14 @@ PARAM_DEFINE_FLOAT(VT_TRANS_THR, 0.6f);
* @group VTOL Attitude Control
*/
PARAM_DEFINE_FLOAT(VT_DWN_PITCH_MAX, 5.0f);
/**
* Fixed wing thrust scale for hover forward flight.
*
* Scale applied to fixed wing thrust being used as source for forward acceleration in multirotor mode.
* This technique can be used to avoid the plane having to pitch down a lot in order to move forward.
* @min 0.0
* @max 2.0
* @group VTOL Attitude Control
*/
PARAM_DEFINE_FLOAT(VT_FWD_THRUST_SC, 1.0f);