From 98732ae4e8d2bb56084c77e262548116ad114d2b Mon Sep 17 00:00:00 2001
From: Randy Mackay <rmackay9@yahoo.com>
Date: Fri, 10 May 2013 10:51:13 +0900
Subject: [PATCH] Copter: remove redundant init of controllers when auto is
 started

individual do_* commands are responsible for setting roll-pitch, yaw and
throttle modes.  Removing this redundant setting of the controllers
removes the short period (10th second max) where loiter and waypoint
controller's desired roll and pitch were used even before the
controllers have been run once.
---
 ArduCopter/system.pde | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/ArduCopter/system.pde b/ArduCopter/system.pde
index 1ffe71f74..cb6f367f6 100644
--- a/ArduCopter/system.pde
+++ b/ArduCopter/system.pde
@@ -372,12 +372,8 @@ static void set_mode(uint8_t mode)
     case AUTO:
     	ap.manual_throttle = false;
     	ap.manual_attitude = false;
-        set_yaw_mode(YAW_HOLD);     // yaw mode will be set by mission command
-        set_roll_pitch_mode(AUTO_RP);
-        set_throttle_mode(AUTO_THR);
-        // we do not set nav mode for auto because it will be overwritten when first command runs
-        // loads the commands from where we left off
-        init_commands();
+        // roll-pitch, throttle and yaw modes will all be set by the first nav command
+        init_commands();            // clear the command queues. will be reloaded when "run_autopilot" calls "update_commands" function
         break;
 
     case CIRCLE:
-- 
GitLab