Skip to content

Commit

Permalink
FixedWingAttitudeControl: convert desired bodyrates between mc and fw…
Browse files Browse the repository at this point in the history
… frame

Signed-off-by: Roman <bapstroman@gmail.com>
  • Loading branch information
RomanBapst committed Apr 12, 2018
1 parent 220e987 commit 0f49337
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/modules/fw_att_control/FixedwingAttitudeControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,14 @@ FixedwingAttitudeControl::vehicle_rates_setpoint_poll()

if (rates_sp_updated) {
orb_copy(ORB_ID(vehicle_rates_setpoint), _rates_sp_sub, &_rates_sp);

if (_parameters.vtol_type == vtol_type::TAILSITTER) {
float tmp = _rates_sp.roll;
_rates_sp.roll = -_rates_sp.yaw;
_rates_sp.yaw = tmp;
}


}
}

Expand Down Expand Up @@ -822,15 +830,8 @@ void FixedwingAttitudeControl::run()
} else {
vehicle_rates_setpoint_poll();

if (_parameters.vtol_type == vtol_type::TAILSITTER) {
_roll_ctrl.set_bodyrate_setpoint(-_rates_sp.yaw);
_yaw_ctrl.set_bodyrate_setpoint(_rates_sp.roll);

} else {
_roll_ctrl.set_bodyrate_setpoint(_rates_sp.roll);
_yaw_ctrl.set_bodyrate_setpoint(_rates_sp.yaw);
}

_roll_ctrl.set_bodyrate_setpoint(_rates_sp.roll);
_yaw_ctrl.set_bodyrate_setpoint(_rates_sp.yaw);
_pitch_ctrl.set_bodyrate_setpoint(_rates_sp.pitch);

float roll_u = _roll_ctrl.control_bodyrate(control_input);
Expand Down

0 comments on commit 0f49337

Please sign in to comment.