From 50015b4196f2d229fae386e763deeaf4c3462961 Mon Sep 17 00:00:00 2001 From: Clyde McQueen Date: Fri, 12 Apr 2024 07:29:46 -0700 Subject: [PATCH 1/3] autotest: reduce SITL baro noise --- Tools/autotest/default_params/sub-6dof.parm | 3 ++- Tools/autotest/default_params/sub.parm | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Tools/autotest/default_params/sub-6dof.parm b/Tools/autotest/default_params/sub-6dof.parm index 67c7af365f63b4..1c65ff7eb50515 100644 --- a/Tools/autotest/default_params/sub-6dof.parm +++ b/Tools/autotest/default_params/sub-6dof.parm @@ -1,4 +1,3 @@ -BARO_RND 0.02 BATT_MONITOR 4 BTN0_FUNCTION 0 BTN10_SFUNCTION 0 @@ -59,4 +58,6 @@ INS_ACC3OFFS_Z 0.000 INS_ACC3SCAL_X 1.000 INS_ACC3SCAL_Y 1.000 INS_ACC3SCAL_Z 1.000 +LOG_BITMASK 180222 +SIM_BARO_RND 0.02 FRAME_CONFIG 2.000 \ No newline at end of file diff --git a/Tools/autotest/default_params/sub.parm b/Tools/autotest/default_params/sub.parm index bef934263fbfbd..65615aa5f2abdd 100644 --- a/Tools/autotest/default_params/sub.parm +++ b/Tools/autotest/default_params/sub.parm @@ -86,4 +86,5 @@ BARO_EXT_BUS 1 PILOT_ACCEL_Z 200 PILOT_SPEED_UP 200 PSC_JERK_Z 8 -LOG_BITMASK,180222 +LOG_BITMASK 180222 +SIM_BARO_RND 0.02 From 3be1b9efa6163e702995b536fcc1addebe8d1980 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Thu, 7 Mar 2024 14:34:24 +1100 Subject: [PATCH 2/3] autotest: add set_home function --- Tools/autotest/vehicle_test_suite.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Tools/autotest/vehicle_test_suite.py b/Tools/autotest/vehicle_test_suite.py index d223290addb1e4..e752171665112f 100644 --- a/Tools/autotest/vehicle_test_suite.py +++ b/Tools/autotest/vehicle_test_suite.py @@ -8993,6 +8993,15 @@ def monitor_groundspeed(self, want, tolerance=0.5, timeout=5): self.progress("GroundSpeed OK (got=%f) (want=%f)" % (m.groundspeed, want)) + def set_home(self, loc): + '''set home to supplied loc''' + self.run_cmd_int( + mavutil.mavlink.MAV_CMD_DO_SET_HOME, + p5=int(loc.lat*1e7), + p6=int(loc.lng*1e7), + p7=loc.alt, + ) + def SetHome(self): '''Setting and fetching of home''' if self.is_tracker(): From 77cccd08a34e1203147d4448461d984889f64a20 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Thu, 7 Mar 2024 14:34:56 +1100 Subject: [PATCH 3/3] autotest: add test for moving from loiter to guided --- Tools/autotest/arducopter.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Tools/autotest/arducopter.py b/Tools/autotest/arducopter.py index 9b47f12106a4be..b71247338ac89e 100644 --- a/Tools/autotest/arducopter.py +++ b/Tools/autotest/arducopter.py @@ -10828,6 +10828,21 @@ def CameraLogMessages(self): if abs(got - want) > 1: raise NotAchievedException(f"Incorrect relalt {want=} {got=}") + def LoiterToGuidedHomeVSOrigin(self): + '''test moving from guided to loiter mode when home is a different alt + to origin''' + self.set_parameters({ + "TERRAIN_ENABLE": 1, + "SIM_TERRAIN": 1, + }) + self.takeoff(10, mode='GUIDED') + here = self.mav.location() + self.set_home(here) + self.change_mode('LOITER') + self.wait_altitude(here.alt-1, here.alt+1, minimum_duration=10) + self.disarm_vehicle(force=True) + self.reboot_sitl() # to "unstick" home + def tests2b(self): # this block currently around 9.5mins here '''return list of all tests''' ret = ([ @@ -10906,6 +10921,7 @@ def tests2b(self): # this block currently around 9.5mins here self.PILOT_THR_BHV, self.GPSForYawCompassLearn, self.CameraLogMessages, + self.LoiterToGuidedHomeVSOrigin, ]) return ret