From 653a1113fce1666dd3571591f0a9f66de78af4bd Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 19 Mar 2024 18:21:13 +1100 Subject: [PATCH 1/4] ArduCopter: remove restriction that fence be enabled for avoidance the technical reasons in Avoidance were fixed a long time ago --- ArduCopter/Copter.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ArduCopter/Copter.h b/ArduCopter/Copter.h index b3be8285f7f9b..a1f9caa84eef5 100644 --- a/ArduCopter/Copter.h +++ b/ArduCopter/Copter.h @@ -155,10 +155,6 @@ #include // Custom control library #endif -#if AP_AVOIDANCE_ENABLED && !AP_FENCE_ENABLED - #error AC_Avoidance relies on AP_FENCE_ENABLED which is disabled -#endif - #if AP_OAPATHPLANNER_ENABLED && !AP_FENCE_ENABLED #error AP_OAPathPlanner relies on AP_FENCE_ENABLED which is disabled #endif From 583c725ee03814725c5da23a80d90abe3d48776c Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 19 Mar 2024 18:21:13 +1100 Subject: [PATCH 2/4] Tools: remove restriction that fence be enabled for avoidance the technical reasons in Avoidance were fixed a long time ago --- Tools/scripts/build_options.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/scripts/build_options.py b/Tools/scripts/build_options.py index 5d9c1511b4c92..3f21be0eb32ba 100644 --- a/Tools/scripts/build_options.py +++ b/Tools/scripts/build_options.py @@ -42,7 +42,7 @@ def __init__(self, Feature('Safety', 'PARACHUTE', 'HAL_PARACHUTE_ENABLED', 'Enable Parachute', 0, None), Feature('Safety', 'FENCE', 'AP_FENCE_ENABLED', 'Enable Geofence', 2, None), Feature('Safety', 'RALLY', 'HAL_RALLY_ENABLED', 'Enable Rally Points', 0, None), # noqa - Feature('Safety', 'AC_AVOID', 'AP_AVOIDANCE_ENABLED', 'Enable Avoidance', 0, 'FENCE'), + Feature('Safety', 'AC_AVOID', 'AP_AVOIDANCE_ENABLED', 'Enable Avoidance', 0, None), Feature('Safety', 'AC_OAPATHPLANNER', 'AP_OAPATHPLANNER_ENABLED', 'Enable Object Avoidance Path Planner', 0, 'FENCE'), Feature('Battery', 'BATTERY_FUELFLOW', 'AP_BATTERY_FUELFLOW_ENABLED', 'Enable Fuel Flow BatteryMonitor', 0, None), From 7079000bb2a825338836688d015d60543b397cee Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 19 Mar 2024 17:32:52 +1100 Subject: [PATCH 3/4] autotest: take a list of globs that can match features useful if you need to test multiple features at the same time --- Tools/autotest/test_build_options.py | 38 ++++++++++++++++++---------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/Tools/autotest/test_build_options.py b/Tools/autotest/test_build_options.py index 9d4b3f1dd411c..37f587d8c2f09 100755 --- a/Tools/autotest/test_build_options.py +++ b/Tools/autotest/test_build_options.py @@ -43,7 +43,7 @@ def __init__(self, feature, vehicle, bytes_delta): class TestBuildOptions(object): def __init__(self, - match_glob=None, + match_glob=[], do_step_disable_all=True, do_step_disable_none=False, do_step_disable_defaults=True, @@ -317,9 +317,13 @@ def run_disable_in_turn(self): options = self.get_build_options_from_ardupilot_tree() count = 1 for feature in sorted(options, key=lambda x : x.define): - if self.match_glob is not None: - if not fnmatch.fnmatch(feature.define, self.match_glob): - continue + match = False + for match_glob in self.match_glob: + if fnmatch.fnmatch(feature.define, match_glob): + match = True + break + if not match: + continue with open("/tmp/run-disable-in-turn-progress", "w") as f: f.write(f"{count}/{len(options)} {feature.define}\n") # if feature.define < "WINCH_ENABLED": @@ -355,9 +359,13 @@ def run_enable_in_turn(self): options = self.get_build_options_from_ardupilot_tree() count = 1 for feature in options: - if self.match_glob is not None: - if not fnmatch.fnmatch(feature.define, self.match_glob): - continue + match = False + for match_glob in self.match_glob: + if fnmatch.fnmatch(feature.define, match_glob): + match = True + break + if not match: + continue self.progress("Enabling feature %s(%s) (%u/%u)" % (feature.label, feature.define, count, len(options))) with open("/tmp/run-enable-in-turn-progress", "w") as f: @@ -377,9 +385,13 @@ def get_disable_all_defines(self): options = self.get_build_options_from_ardupilot_tree() defines = {} for feature in options: - if self.match_glob is not None: - if not fnmatch.fnmatch(feature.define, self.match_glob): - continue + match = False + for match_glob in self.match_glob: + if fnmatch.fnmatch(feature.define, match_glob): + match = True + break + if not match: + continue defines[feature.define] = 0 for define in self.must_have_defines_for_board(self._board): defines[define] = 1 @@ -453,9 +465,9 @@ def run(self): parser = optparse.OptionParser() parser.add_option("--define-match-glob", - type='string', - default=None, - help='feature define must match this glob to be tested') + default=[], + action='append', + help='feature define must match any of these globs to be tested') parser.add_option("--no-run-with-defaults", action='store_true', help='Do not run the run-with-defaults step') From ccb5c3ea920e82e049374e7925e8009206e09bb7 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 20 Mar 2024 21:11:57 +1100 Subject: [PATCH 4/4] AC_Avoidance: compile avoidance even if no fence --- libraries/AC_Avoidance/AC_Avoidance_config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/AC_Avoidance/AC_Avoidance_config.h b/libraries/AC_Avoidance/AC_Avoidance_config.h index 602d06829ca33..aa1622e53a9c0 100644 --- a/libraries/AC_Avoidance/AC_Avoidance_config.h +++ b/libraries/AC_Avoidance/AC_Avoidance_config.h @@ -4,7 +4,7 @@ #include #ifndef AP_AVOIDANCE_ENABLED -#define AP_AVOIDANCE_ENABLED AP_FENCE_ENABLED +#define AP_AVOIDANCE_ENABLED 1 #endif #ifndef AP_OAPATHPLANNER_ENABLED