From 864717310de95e11b2f8fe4fb29485bf1a86acfe Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Thu, 23 Apr 2020 16:37:23 +1000 Subject: [PATCH] autotest: allow specification of EKF type to use on commandline --- Tools/autotest/autotest.py | 5 +++++ Tools/autotest/common.py | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Tools/autotest/autotest.py b/Tools/autotest/autotest.py index 800e171be0..c1ac408c72 100755 --- a/Tools/autotest/autotest.py +++ b/Tools/autotest/autotest.py @@ -379,6 +379,7 @@ def run_step(step): "disable_breakpoints": opts.disable_breakpoints, "frame": opts.frame, "_show_test_timings": opts.show_test_timings, + "force_ahrs_type": opts.force_ahrs_type, } if opts.speedup is not None: fly_opts["speedup"] = opts.speedup @@ -757,6 +758,10 @@ if __name__ == "__main__": default=False, action='store_true', help="disable all breakpoints before starting") + group_sim.add_option("", "--force-ahrs-type", + dest="force_ahrs_type", + default=None, + help="force a specific AHRS type (e.g. 10 for SITL-ekf") parser.add_option_group(group_sim) opts, args = parser.parse_args() diff --git a/Tools/autotest/common.py b/Tools/autotest/common.py index 4e5f731461..2b4d854cf9 100644 --- a/Tools/autotest/common.py +++ b/Tools/autotest/common.py @@ -706,7 +706,8 @@ class AutoTest(ABC): disable_breakpoints=False, viewerip=None, use_map=False, - _show_test_timings=False): + _show_test_timings=False, + force_ahrs_type=None): if binary is None: raise ValueError("Should always have a binary") @@ -740,6 +741,9 @@ class AutoTest(ABC): self.test_timings = dict() self.total_waiting_to_arm_time = 0 self.waiting_to_arm_count = 0 + self.force_ahrs_type = force_ahrs_type + if self.force_ahrs_type is not None: + self.force_ahrs_type = int(self.force_ahrs_type) @staticmethod def progress(text): @@ -848,6 +852,12 @@ class AutoTest(ABC): self.repeatedly_apply_parameter_file(os.path.join(testdir, x)) self.set_parameter('LOG_REPLAY', 1) self.set_parameter('LOG_DISARMED', 1) + if self.force_ahrs_type is not None: + if self.force_ahrs_type == 2: + self.set_parameter("EK2_ENABLE", 1) + if self.force_ahrs_type == 3: + self.set_parameter("EK3_ENABLE", 1) + self.set_parameter("AHRS_EKF_TYPE", self.force_ahrs_type) self.reboot_sitl() self.fetch_parameters() @@ -5572,4 +5582,4 @@ switch value''' defaults_list = [] for d in defaults_filepath: defaults_list.append(os.path.join(testdir, d)) - return ','.join(defaults_list) \ No newline at end of file + return ','.join(defaults_list)