From b2f47ba367a0029529bb56d8fc9394fe1d578aea Mon Sep 17 00:00:00 2001
From: Peter Barker <pbarker@barker.dropbear.id.au>
Date: Thu, 18 Feb 2021 13:13:38 +1100
Subject: [PATCH] autotest: add test for auxilliary functions in missions

---
 .../AuxFunctionsInMission/aux_functions.txt       |  6 ++++++
 Tools/autotest/arducopter.py                      | 15 +++++++++++++++
 2 files changed, 21 insertions(+)
 create mode 100644 Tools/autotest/ArduCopter_Tests/AuxFunctionsInMission/aux_functions.txt

diff --git a/Tools/autotest/ArduCopter_Tests/AuxFunctionsInMission/aux_functions.txt b/Tools/autotest/ArduCopter_Tests/AuxFunctionsInMission/aux_functions.txt
new file mode 100644
index 0000000000..b6b44fb814
--- /dev/null
+++ b/Tools/autotest/ArduCopter_Tests/AuxFunctionsInMission/aux_functions.txt
@@ -0,0 +1,6 @@
+QGC WPL 110
+0	0	0	16	0.000000	0.000000	0.000000	0.000000	-35.363262	149.165237	584.109985	1
+1	0	3	22	0.000000	0.000000	0.000000	0.000000	-35.362790	149.165127	10.000000	1
+2	0	0	218	70.000000	2.000000	0.000000	0.000000	0.000000	0.000000	0.000000	1
+3	0	0	93	20.000000	0.000000	0.000000	0.000000	0.000000	0.000000	0.000000	1
+4	0	0	20	0.000000	0.000000	0.000000	0.000000	0.000000	0.000000	0.000000	1
diff --git a/Tools/autotest/arducopter.py b/Tools/autotest/arducopter.py
index 1af6136b87..fd42391d4b 100644
--- a/Tools/autotest/arducopter.py
+++ b/Tools/autotest/arducopter.py
@@ -5738,6 +5738,17 @@ class AutoTestCopter(AutoTest):
         self.wait_current_waypoint(0, timeout=10)
         self.set_rc(7, 1000)
 
+    def test_aux_functions_in_mission(self):
+        self.load_mission("aux_functions.txt")
+        self.change_mode('LOITER')
+        self.wait_ready_to_arm()
+        self.arm_vehicle()
+        self.change_mode('AUTO')
+        self.set_rc(3, 1500)
+        self.wait_mode('ALT_HOLD')
+        self.change_mode('AUTO')
+        self.wait_rtl_complete()
+
     def fly_rangefinder_drivers_fly(self, rangefinders):
         '''ensure rangefinder gives height-above-ground'''
         self.change_mode('GUIDED')
@@ -6543,6 +6554,10 @@ class AutoTestCopter(AutoTest):
              "Test random aux mode options",
              self.test_aux_switch_options),
 
+            ("AuxFunctionsInMission",
+             "Test use of auxilliary functions in missions",
+             self.test_aux_functions_in_mission),
+
             ("AutoTune",
              "Fly AUTOTUNE mode",
              self.fly_autotune),  # 73s