Fixed wing heading hold: Engage only after wings got close to level already

This commit is contained in:
Lorenz Meier 2015-05-29 11:53:34 -07:00
parent 21fde4b3f6
commit 46d969772c
2 changed files with 2 additions and 5 deletions

View File

@ -858,7 +858,7 @@ FixedwingAttitudeControl::task_main()
/* the pilot does not want to change direction,
* take straight attitude setpoint from position controller
*/
if (fabsf(_manual.y) < 0.01f) {
if (fabsf(_manual.y) < 0.01f && fabsf(_att.roll) < 0.2f) {
roll_sp = _att_sp.roll_body + _parameters.rollsp_offset_rad;
} else {
roll_sp = (_manual.y * _parameters.man_roll_max - _parameters.trim_roll)

View File

@ -1411,12 +1411,9 @@ FixedwingPositionControl::control_position(const math::Vector<2> &current_positi
/* heading control */
if (fabsf(_manual.y) < 0.01f) {
if (fabsf(_manual.y) < 0.01f && fabsf(_att.roll) < 0.2f) {
/* heading / roll is zero, lock onto current heading */
// XXX calculate a waypoint in some distance
// and lock on to it
/* just switched back from non heading-hold to heading hold */
if (!_hdg_hold_enabled) {
_hdg_hold_enabled = true;