From 21bd2b700875a97dfe127a328d3546b30bb987e5 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 4 May 2021 21:12:24 +1000 Subject: [PATCH] Tools: allow for double EKF build --- Tools/CPUInfo/EKF_Maths.h | 3 +-- Tools/ardupilotwaf/boards.py | 4 ++-- Tools/autotest/sim_vehicle.py | 12 ++++++++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Tools/CPUInfo/EKF_Maths.h b/Tools/CPUInfo/EKF_Maths.h index 017fae43a3..6254203ac4 100644 --- a/Tools/CPUInfo/EKF_Maths.h +++ b/Tools/CPUInfo/EKF_Maths.h @@ -4,10 +4,9 @@ data structure for measuring speed of EKF mag fusion code */ #include +#include #include -typedef float ftype; - class EKF_Maths { public: EKF_Maths() {} diff --git a/Tools/ardupilotwaf/boards.py b/Tools/ardupilotwaf/boards.py index c9ba9a534a..d252d188f2 100644 --- a/Tools/ardupilotwaf/boards.py +++ b/Tools/ardupilotwaf/boards.py @@ -342,10 +342,10 @@ class Board: env.ROMFS_FILES += [(f,'libraries/AP_OSD/fonts/'+f)] if cfg.options.ekf_double: - env.CXXFLAGS += ['-DHAL_EKF_DOUBLE=1'] + env.CXXFLAGS += ['-DHAL_WITH_EKF_DOUBLE=1'] if cfg.options.ekf_single: - env.CXXFLAGS += ['-DHAL_EKF_DOUBLE=0'] + env.CXXFLAGS += ['-DHAL_WITH_EKF_DOUBLE=0'] def pre_build(self, bld): '''pre-build hook that gets called before dynamic sources''' diff --git a/Tools/autotest/sim_vehicle.py b/Tools/autotest/sim_vehicle.py index 86e908991b..d023e84cc5 100755 --- a/Tools/autotest/sim_vehicle.py +++ b/Tools/autotest/sim_vehicle.py @@ -327,6 +327,12 @@ def do_build(opts, frame_options): if opts.postype_single: cmd_configure.append("--postype-single") + if opts.ekf_double: + cmd_configure.append("--ekf-double") + + if opts.ekf_single: + cmd_configure.append("--ekf-single") + pieces = [shlex.split(x) for x in opts.waf_configure_args] for piece in pieces: cmd_configure.extend(piece) @@ -1088,6 +1094,12 @@ group_sim.add_option("", "--sysid", group_sim.add_option("--postype-single", action='store_true', help="force single precision postype_t") +group_sim.add_option("--ekf-double", + action='store_true', + help="use double precision in EKF") +group_sim.add_option("--ekf-single", + action='store_true', + help="use single precision in EKF") parser.add_option_group(group_sim)