autotest: augment simulated GPS tests

This commit is contained in:
Peter Barker 2021-10-13 11:01:26 +11:00 committed by Peter Barker
parent d1c7ed1c82
commit 7446a28c45

View File

@ -10770,19 +10770,26 @@ switch value'''
'''check each simulated GPS works''' '''check each simulated GPS works'''
self.reboot_sitl() self.reboot_sitl()
orig = self.poll_home_position(timeout=60) orig = self.poll_home_position(timeout=60)
# (sim_gps_type, name, gps_type, detection name)
# if gps_type is None we auto-detect
sim_gps = [ sim_gps = [
# (0, "NONE"), # (0, "NONE"),
(1, "UBLOX"), (1, "UBLOX", None, "u-blox"),
# (5, "NMEA"), # broken (5, "NMEA", 5, "NMEA"),
(6, "SBP"), (6, "SBP", None, "SBP"),
# (7, "SBP2"), # broken # (7, "SBP2", 9, "SBP2"), # broken, "waiting for config data"
# (8, "NOVA"), # broken (8, "NOVA", 15, "NOVA"), # no attempt to auto-detect this in AP_GPS
# (9, "FILE"), # (9, "FILE"),
] ]
for (sim_gps_type, name) in sim_gps: for (sim_gps_type, name, gps_type, detect_name) in sim_gps:
self.start_subtest("Checking GPS type %s" % name) self.start_subtest("Checking GPS type %s" % name)
self.set_parameter("SIM_GPS_TYPE", sim_gps_type) self.set_parameter("SIM_GPS_TYPE", sim_gps_type)
if gps_type is None:
gps_type = 1 # auto-detect
self.set_parameter("GPS_TYPE", gps_type)
self.context_collect("STATUSTEXT")
self.reboot_sitl() self.reboot_sitl()
self.wait_statustext("detected as %s" % detect_name, check_context=True)
n = self.poll_home_position(timeout=120) n = self.poll_home_position(timeout=120)
distance = self.get_distance_int(orig, n) distance = self.get_distance_int(orig, n)
if distance > 1: if distance > 1: