adapted tailsitter code to structural changes in vtol_att_control_main

This commit is contained in:
tumbili 2015-08-07 13:21:09 +02:00
parent 02fda7a0f5
commit c1025ca44e
2 changed files with 34 additions and 46 deletions

View File

@ -73,13 +73,6 @@ void Tailsitter::update_mc_state()
}
}
void Tailsitter::process_mc_data()
{
// scale pitch control with total airspeed
//scale_mc_output();
fill_mc_att_control_output();
}
void Tailsitter::update_fw_state()
{
if (flag_idle_mc) {
@ -88,11 +81,6 @@ void Tailsitter::update_fw_state()
}
}
void Tailsitter::process_fw_data()
{
fill_fw_att_control_output();
}
void Tailsitter::update_transition_state()
{
@ -152,38 +140,41 @@ Tailsitter::scale_mc_output()
}
/**
* Prepare message to acutators with data from fw attitude controller.
* Write data to actuator output topic.
*/
void Tailsitter::fill_fw_att_control_output()
void Tailsitter::fill_actuator_outputs()
{
/*For the first test in fw mode, only use engines for thrust!!!*/
_actuators_out_0->control[0] = 0;
_actuators_out_0->control[1] = 0;
_actuators_out_0->control[2] = 0;
_actuators_out_0->control[3] = _actuators_fw_in->control[3];
/*controls for the elevons */
_actuators_out_1->control[0] = -_actuators_fw_in->control[0]; // roll elevon
_actuators_out_1->control[1] = _actuators_fw_in->control[1] + _params->fw_pitch_trim; // pitch elevon
// unused now but still logged
_actuators_out_1->control[2] = _actuators_fw_in->control[2]; // yaw
_actuators_out_1->control[3] = _actuators_fw_in->control[3]; // throttle
}
switch(_vtol_mode) {
case ROTARY_WING:
_actuators_out_0->control[0] = _actuators_mc_in->control[0];
_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];
/**
* Prepare message to acutators with data from mc attitude controller.
*/
void Tailsitter::fill_mc_att_control_output()
{
_actuators_out_0->control[0] = _actuators_mc_in->control[0];
_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];
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
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
}
break;
case FIXED_WING:
/*For the first test in fw mode, only use engines for thrust!!!*/
_actuators_out_0->control[0] = 0;
_actuators_out_0->control[1] = 0;
_actuators_out_0->control[2] = 0;
_actuators_out_0->control[3] = _actuators_fw_in->control[3];
/*controls for the elevons */
_actuators_out_1->control[0] = -_actuators_fw_in->control[0]; // roll elevon
_actuators_out_1->control[1] = _actuators_fw_in->control[1] + _params->fw_pitch_trim; // pitch elevon
// unused now but still logged
_actuators_out_1->control[2] = _actuators_fw_in->control[2]; // yaw
_actuators_out_1->control[3] = _actuators_fw_in->control[3]; // throttle
break;
case TRANSITION:
case EXTERNAL:
// not yet implemented, we are switching brute force at the moment
break;
}
}

View File

@ -53,15 +53,12 @@ public:
void update_vtol_state();
void update_mc_state();
void process_mc_data();
void update_fw_state();
void process_fw_data();
void update_transition_state();
void update_external_state();
private:
void fill_mc_att_control_output();
void fill_fw_att_control_output();
void fill_actuator_outputs();
void calc_tot_airspeed();
void scale_mc_output();