From 2271827c9d0ec2273b52a637bf86f3c78a46c50e Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 18 Apr 2023 08:57:13 +1000 Subject: [PATCH] autotest: add tests for compass prearms --- Tools/autotest/common.py | 21 +++++++++++++++++++++ Tools/autotest/rover.py | 1 + 2 files changed, 22 insertions(+) diff --git a/Tools/autotest/common.py b/Tools/autotest/common.py index ae12722a59..a26162e0ad 100644 --- a/Tools/autotest/common.py +++ b/Tools/autotest/common.py @@ -12907,6 +12907,27 @@ switch value''' if ex is not None: raise ex + def CompassPrearms(self): + '''test compass prearm checks''' + self.wait_ready_to_arm() + # XY are checked specially: + for axis in 'X', 'Y': # ArduPilot only checks these two axes + self.context_push() + self.set_parameter(f"COMPASS_OFS2_{axis}", 1000) + self.assert_prearm_failure("Compasses inconsistent") + self.context_pop() + self.wait_ready_to_arm() + + # now test the total anglular difference: + self.context_push() + self.set_parameters({ + "COMPASS_OFS2_X": 1000, + "COMPASS_OFS2_Y": -1000, + "COMPASS_OFS2_Z": -10000, + }) + self.assert_prearm_failure("Compasses inconsistent") + self.context_pop() + def AHRS_ORIENTATION(self): '''test AHRS_ORIENTATION parameter works''' self.context_push() diff --git a/Tools/autotest/rover.py b/Tools/autotest/rover.py index 1a8f71231a..d2e5a40487 100644 --- a/Tools/autotest/rover.py +++ b/Tools/autotest/rover.py @@ -6355,6 +6355,7 @@ Brakes have negligible effect (with=%0.2fm without=%0.2fm delta=%0.2fm) self.InitialMode, self.DriveMaxRCIN, self.NoArmWithoutMissionItems, + self.CompassPrearms, ]) return ret