From 53caf9ee3e541e85947daba4aa29b021cad3c74a Mon Sep 17 00:00:00 2001
From: Michael Day <michael.day@gtri.gatech.edu>
Date: Tue, 20 Dec 2016 21:56:40 -0500
Subject: [PATCH] Plane: decrease heading tolerance when leaving loiter
 waypoint. Improves autoland

This changes the heading tolerance when leaving a loiter waypoint and
tyring to maintain a heading towards the next waypoint from 20 degrees
(+/- 10) to 6 degrees (+/-).  This results in a much more reliable
landing approach as the plane is more likely to line up with a runway.
---
 ArduPlane/commands_logic.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ArduPlane/commands_logic.cpp b/ArduPlane/commands_logic.cpp
index dfcdae4ef2..8e5744b358 100644
--- a/ArduPlane/commands_logic.cpp
+++ b/ArduPlane/commands_logic.cpp
@@ -1026,13 +1026,13 @@ bool Plane::verify_loiter_heading(bool init)
 
     /*
       Check to see if the the plane is heading toward the land
-      waypoint. We use 20 degrees (+/-10 deg) of margin so that
-      we can handle 200 degrees/second of yaw. Allow turn count
+      waypoint. We use 6 degrees (+/-3 deg) of margin so that
+      we can handle xxx degrees/second of yaw. Allow turn count
       to stop it too to ensure we don't loop around forever in
       case high winds are forcing us beyond 200 deg/sec at this
       particular moment.
     */
-    if (labs(heading_err_cd) <= 1000  ||
+    if (labs(heading_err_cd) <= 300  ||
             loiter.sum_cd > loiter.total_cd) {
         // Want to head in a straight line from _here_ to the next waypoint instead of center of loiter wp
 
-- 
GitLab