Skip to content

Commit

Permalink
VTOL control back transition ramp up time
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderux committed Aug 6, 2017
1 parent f4c0608 commit 5f43fde
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/modules/vtol_att_control/standard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Standard::Standard(VtolAttitudeControl *attc) :

_params_handles_standard.front_trans_dur = param_find("VT_F_TRANS_DUR");
_params_handles_standard.back_trans_dur = param_find("VT_B_TRANS_DUR");
_params_handles_standard.back_trans_ramp = param_find("VT_B_TRANS_RAMP");
_params_handles_standard.pusher_trans = param_find("VT_TRANS_THR");
_params_handles_standard.airspeed_blend = param_find("VT_ARSP_BLEND");
_params_handles_standard.airspeed_trans = param_find("VT_ARSP_TRANS");
Expand Down Expand Up @@ -97,6 +98,10 @@ Standard::parameters_update()
param_get(_params_handles_standard.back_trans_dur, &v);
_params_standard.back_trans_dur = math::constrain(v, 0.0f, 20.0f);

/* MC ramp up during back transition to mc mode */
param_get(_params_handles_standard.back_trans_ramp, &v);
_params_standard.back_trans_ramp = math::constrain(v, 0.0f, _params_standard.back_trans_dur);

/* target throttle value for pusher motor during the transition to fw mode */
param_get(_params_handles_standard.pusher_trans, &v);
_params_standard.pusher_trans = math::constrain(v, 0.0f, 5.0f);
Expand Down Expand Up @@ -355,9 +360,9 @@ void Standard::update_transition_state()
}

// continually increase mc attitude control as we transition back to mc mode
if (_params_standard.back_trans_dur > FLT_EPSILON) {
if (_params_standard.back_trans_ramp > FLT_EPSILON) {
float weight = (float)hrt_elapsed_time(&_vtol_schedule.transition_start) /
((_params_standard.back_trans_dur / 2) * 1000000.0f);
((_params_standard.back_trans_ramp) * 1000000.0f);
weight = math::constrain(weight, 0.0f, 1.0f);
_mc_roll_weight = weight;
_mc_pitch_weight = weight;
Expand Down
2 changes: 2 additions & 0 deletions src/modules/vtol_att_control/standard.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class Standard : public VtolType
struct {
float front_trans_dur;
float back_trans_dur;
float back_trans_ramp;
float pusher_trans;
float airspeed_blend;
float airspeed_trans;
Expand All @@ -86,6 +87,7 @@ class Standard : public VtolType
struct {
param_t front_trans_dur;
param_t back_trans_dur;
param_t back_trans_ramp;
param_t pusher_trans;
param_t airspeed_blend;
param_t airspeed_trans;
Expand Down
12 changes: 12 additions & 0 deletions src/modules/vtol_att_control/standard_params.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,15 @@ PARAM_DEFINE_FLOAT(VT_DWN_PITCH_MAX, 5.0f);
* @group VTOL Attitude Control
*/
PARAM_DEFINE_FLOAT(VT_FWD_THRUST_SC, 0.0f);

/**
* Back transition MC motor ramp up time
*
* This sets the duration during wich the MC motors ramp up to the commanded thrust during the back transition stage.
*
* @unit s
* @min 0.0
* @max 20.0
* @group VTOL Attitude Control
*/
PARAM_DEFINE_FLOAT(VT_B_TRANS_RAMP, 3.0f);

0 comments on commit 5f43fde

Please sign in to comment.