mc_att_control: yaw offset limiting bug fixed

This commit is contained in:
Anton Babushkin 2014-05-15 10:22:42 +02:00
parent 42a7d80a81
commit 8e43db7bc0
1 changed files with 2 additions and 2 deletions

View File

@ -509,10 +509,10 @@ MulticopterAttitudeControl::control_attitude(float dt)
float yaw_offs_max = _params.man_yaw_max / _params.att_p(2);
float yaw_offs = _wrap_pi(_v_att_sp.yaw_body - _v_att.yaw);
if (yaw_offs < - yaw_offs_max) {
_v_att_sp.yaw_body = _wrap_pi(_v_att.yaw - yaw_offs);
_v_att_sp.yaw_body = _wrap_pi(_v_att.yaw - yaw_offs_max);
} else if (yaw_offs > yaw_offs_max) {
_v_att_sp.yaw_body = _wrap_pi(_v_att.yaw + yaw_offs);
_v_att_sp.yaw_body = _wrap_pi(_v_att.yaw + yaw_offs_max);
}
_v_att_sp.R_valid = false;
publish_att_sp = true;