allow yaw setpoint offset to be reduced once maxed out

This commit is contained in:
Andreas Antener
2016-06-24 23:01:17 +02:00
parent 377726a9a7
commit 5dcc62d8f9
@@ -1975,10 +1975,10 @@ MulticopterPositionControl::task_main()
float yaw_offs = _wrap_pi(yaw_target - _yaw);
// If the yaw offset became too big for the system to track stop
// shifting it
// XXX this needs inspection - probably requires a clamp, not an if
if (fabsf(yaw_offs) < yaw_offset_max) {
// shifting it, only allow if it would make the offset smaller again.
if (fabsf(yaw_offs) < yaw_offset_max ||
(_att_sp.yaw_sp_move_rate > 0 && yaw_offs < 0) ||
(_att_sp.yaw_sp_move_rate < 0 && yaw_offs > 0)) {
_att_sp.yaw_body = yaw_target;
}
}