Skip to content
Snippets Groups Projects
Commit adf1fea5 authored by Beat Küng's avatar Beat Küng
Browse files

mc_att_control: fix for Rattitude mode

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.
parent 36ee0297
No related branches found
No related tags found
No related merge requests found
...@@ -876,13 +876,12 @@ MulticopterAttitudeControl::run() ...@@ -876,13 +876,12 @@ MulticopterAttitudeControl::run()
attitude_dt += dt; attitude_dt += dt;
/* Check if we are in rattitude mode and the pilot is above the threshold on pitch /* 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 */ * even bother running the attitude controllers */
if (_v_control_mode.flag_control_rattitude_enabled) { if (_v_control_mode.flag_control_rattitude_enabled) {
if (fabsf(_manual_control_sp.y) > _rattitude_thres.get() || _v_control_mode.flag_control_attitude_enabled =
fabsf(_manual_control_sp.x) > _rattitude_thres.get()) { fabsf(_manual_control_sp.y) <= _rattitude_thres.get() &&
_v_control_mode.flag_control_attitude_enabled = false; fabsf(_manual_control_sp.x) <= _rattitude_thres.get();
}
} }
bool attitude_setpoint_generated = false; bool attitude_setpoint_generated = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment