VTOL standard respect VT_ELEV_MC_LOCK

This commit is contained in:
Daniel Agar
2018-01-11 16:18:47 -05:00
parent 2756c76613
commit 137a2444a8
8 changed files with 26 additions and 30 deletions
+22 -9
View File
@@ -517,13 +517,12 @@ void Standard::fill_actuator_outputs()
// fixed wing controls
_actuators_out_1->timestamp = _actuators_fw_in->timestamp;
if (_vtol_schedule.flight_mode != MC_MODE) {
//roll
// roll
_actuators_out_1->control[actuator_controls_s::INDEX_ROLL] =
-_actuators_fw_in->control[actuator_controls_s::INDEX_ROLL];
//pitch
// pitch
_actuators_out_1->control[actuator_controls_s::INDEX_PITCH] =
_actuators_fw_in->control[actuator_controls_s::INDEX_PITCH] + _params->fw_pitch_trim;
// yaw
@@ -534,11 +533,25 @@ void Standard::fill_actuator_outputs()
} else {
// zero outputs when inactive
_actuators_out_1->control[actuator_controls_s::INDEX_ROLL] = 0.0f;
_actuators_out_1->control[actuator_controls_s::INDEX_PITCH] = _params->fw_pitch_trim;
_actuators_out_1->control[actuator_controls_s::INDEX_YAW] = 0.0f;
_actuators_out_1->control[actuator_controls_s::INDEX_AIRBRAKES] = 0.0f;
if (_params->elevons_mc_lock) {
// zero outputs when inactive
_actuators_out_1->control[actuator_controls_s::INDEX_ROLL] = 0.0f;
_actuators_out_1->control[actuator_controls_s::INDEX_PITCH] = _params->fw_pitch_trim;
_actuators_out_1->control[actuator_controls_s::INDEX_YAW] = 0.0f;
_actuators_out_1->control[actuator_controls_s::INDEX_AIRBRAKES] = 0.0f;
} else {
// roll
_actuators_out_1->control[actuator_controls_s::INDEX_ROLL] =
-_actuators_fw_in->control[actuator_controls_s::INDEX_ROLL];
// pitch
_actuators_out_1->control[actuator_controls_s::INDEX_PITCH] =
_actuators_fw_in->control[actuator_controls_s::INDEX_PITCH] + _params->fw_pitch_trim;
_actuators_out_1->control[actuator_controls_s::INDEX_YAW] = 0.0f;
_actuators_out_1->control[actuator_controls_s::INDEX_AIRBRAKES] = 0.0f;
}
}
// set the fixed wing throttle control
+1 -8
View File
@@ -69,8 +69,6 @@ Tailsitter::Tailsitter(VtolAttitudeControl *attc) :
_params_handles_tailsitter.back_trans_dur = param_find("VT_B_TRANS_DUR");
_params_handles_tailsitter.airspeed_trans = param_find("VT_ARSP_TRANS");
_params_handles_tailsitter.airspeed_blend_start = param_find("VT_ARSP_BLEND");
_params_handles_tailsitter.elevons_mc_lock = param_find("VT_ELEV_MC_LOCK");
}
Tailsitter::~Tailsitter()
@@ -82,7 +80,6 @@ void
Tailsitter::parameters_update()
{
float v;
int l;
/* vtol duration of a front transition */
param_get(_params_handles_tailsitter.front_trans_dur, &v);
@@ -104,10 +101,6 @@ Tailsitter::parameters_update()
param_get(_params_handles_tailsitter.airspeed_blend_start, &v);
_params_tailsitter.airspeed_blend_start = v;
/* vtol lock elevons in multicopter */
param_get(_params_handles_tailsitter.elevons_mc_lock, &l);
_params_tailsitter.elevons_mc_lock = l;
/* avoid parameters which will lead to zero division in the transition code */
_params_tailsitter.front_trans_dur = math::max(_params_tailsitter.front_trans_dur, _min_front_trans_dur);
@@ -389,7 +382,7 @@ void Tailsitter::fill_actuator_outputs()
_actuators_out_1->timestamp = _actuators_mc_in->timestamp;
if (_params->elevons_mc_lock == 1) {
if (_params->elevons_mc_lock) {
_actuators_out_1->control[0] = 0;
_actuators_out_1->control[1] = 0;
@@ -69,8 +69,6 @@ private:
float back_trans_dur; /**< duration of back transition */
float airspeed_trans; /**< airspeed at which we switch to fw mode after transition */
float airspeed_blend_start; /**< airspeed at which we start blending mc/fw controls */
int elevons_mc_lock; /**< lock elevons in multicopter mode */
} _params_tailsitter;
struct {
@@ -79,7 +77,6 @@ private:
param_t back_trans_dur;
param_t airspeed_trans;
param_t airspeed_blend_start;
param_t elevons_mc_lock;
} _params_handles_tailsitter;
@@ -66,7 +66,6 @@ Tiltrotor::Tiltrotor(VtolAttitudeControl *attc) :
_params_handles_tiltrotor.tilt_fw = param_find("VT_TILT_FW");
_params_handles_tiltrotor.airspeed_trans = param_find("VT_ARSP_TRANS");
_params_handles_tiltrotor.airspeed_blend_start = param_find("VT_ARSP_BLEND");
_params_handles_tiltrotor.elevons_mc_lock = param_find("VT_ELEV_MC_LOCK");
_params_handles_tiltrotor.front_trans_dur_p2 = param_find("VT_TRANS_P2_DUR");
_params_handles_tiltrotor.fw_motors_off = param_find("VT_FW_MOT_OFFID");
_params_handles_tiltrotor.airspeed_disabled = param_find("FW_ARSP_MODE");
@@ -117,10 +116,6 @@ Tiltrotor::parameters_update()
param_get(_params_handles_tiltrotor.airspeed_blend_start, &v);
_params_tiltrotor.airspeed_blend_start = v;
/* vtol lock elevons in multicopter */
param_get(_params_handles_tiltrotor.elevons_mc_lock, &l);
_params_tiltrotor.elevons_mc_lock = l;
/* vtol front transition phase 2 duration */
param_get(_params_handles_tiltrotor.front_trans_dur_p2, &v);
_params_tiltrotor.front_trans_dur_p2 = v;
-2
View File
@@ -69,7 +69,6 @@ private:
float tilt_fw; /**< actuator value corresponding to fw tilt */
float airspeed_trans; /**< airspeed at which we switch to fw mode after transition */
float airspeed_blend_start; /**< airspeed at which we start blending mc/fw controls */
int32_t elevons_mc_lock; /**< lock elevons in multicopter mode */
float front_trans_dur_p2;
int32_t fw_motors_off; /**< bitmask of all motors that should be off in fixed wing mode */
int32_t airspeed_disabled;
@@ -85,7 +84,6 @@ private:
param_t tilt_fw;
param_t airspeed_trans;
param_t airspeed_blend_start;
param_t elevons_mc_lock;
param_t front_trans_dur_p2;
param_t fw_motors_off;
param_t airspeed_disabled;
@@ -448,7 +448,7 @@ VtolAttitudeControl::parameters_update()
/* vtol lock elevons in multicopter */
param_get(_params_handles.elevons_mc_lock, &l);
_params.elevons_mc_lock = l;
_params.elevons_mc_lock = (l == 1);
/* minimum relative altitude for FW mode (QuadChute) */
param_get(_params_handles.fw_min_alt, &v);
@@ -107,7 +107,7 @@ PARAM_DEFINE_INT32(VT_TYPE, 0);
* @boolean
* @group VTOL Attitude Control
*/
PARAM_DEFINE_INT32(VT_ELEV_MC_LOCK, 0);
PARAM_DEFINE_INT32(VT_ELEV_MC_LOCK, 1);
/**
* Duration of a front transition
+1 -1
View File
@@ -51,7 +51,7 @@ struct Params {
int32_t vtol_motor_count; // number of motors
float fw_pitch_trim; // trim for neutral elevon position in fw mode
int32_t vtol_type;
int32_t elevons_mc_lock; // lock elevons in multicopter mode
bool elevons_mc_lock; // lock elevons in multicopter mode
float fw_min_alt; // minimum relative altitude for FW mode (QuadChute)
float fw_alt_err; // maximum negative altitude error for FW mode (Adaptive QuadChute)
float fw_qc_max_pitch; // maximum pitch angle FW mode (QuadChute)