Skip to content

Commit

Permalink
mc_att_control: fix for Rattitude mode
Browse files Browse the repository at this point in the history
When switching back from rate to attitude control, the code depended on a
vehicle_control_mode topics update, but the publication frequency of that
is low. So the switch was noticeably delayed.
  • Loading branch information
bkueng committed Nov 5, 2018
1 parent d2eb77d commit fa4f38f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/modules/mc_att_control/mc_att_control_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -876,13 +876,12 @@ MulticopterAttitudeControl::run()
attitude_dt += dt;

/* Check if we are in rattitude mode and the pilot is above the threshold on pitch
* or roll (yaw can rotate 360 in normal att control). If both are true don't
* or roll (yaw can rotate 360 in normal att control). If both are true don't
* even bother running the attitude controllers */
if (_v_control_mode.flag_control_rattitude_enabled) {
if (fabsf(_manual_control_sp.y) > _rattitude_thres.get() ||
fabsf(_manual_control_sp.x) > _rattitude_thres.get()) {
_v_control_mode.flag_control_attitude_enabled = false;
}
_v_control_mode.flag_control_attitude_enabled =
fabsf(_manual_control_sp.y) <= _rattitude_thres.get() &&
fabsf(_manual_control_sp.x) <= _rattitude_thres.get();
}

bool attitude_setpoint_generated = false;
Expand Down

0 comments on commit fa4f38f

Please sign in to comment.