Skip to content

Commit 23942c1

Browse files
committed
autotest: add test for many-gps support
1 parent f7e3aec commit 23942c1

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

Tools/autotest/arducopter.py

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12168,6 +12168,82 @@ def CommonOrigin(self):
1216812168
# restart GPS driver
1216912169
self.reboot_sitl()
1217012170

12171+
def ManyGPS(self):
12172+
'''check many gps support'''
12173+
self.set_parameters({
12174+
'GPS2_TYPE': 1,
12175+
'GPS3_TYPE': 1,
12176+
'GPS4_TYPE': 1,
12177+
12178+
'SIM_GPS1_NUMSATS': 21,
12179+
12180+
'SIM_GPS2_ENABLE': 1,
12181+
'SIM_GPS2_NUMSATS': 22,
12182+
12183+
'SIM_GPS3_TYPE': 1,
12184+
'SIM_GPS3_ENABLE': 1,
12185+
'SIM_GPS3_NUMSATS': 23,
12186+
12187+
'SIM_GPS4_TYPE': 1,
12188+
'SIM_GPS4_ENABLE': 1,
12189+
'SIM_GPS4_NUMSATS': 24,
12190+
12191+
'SERIAL5_PROTOCOL': 5,
12192+
'SERIAL6_PROTOCOL': 5,
12193+
})
12194+
self.customise_SITL_commandline([
12195+
"--serial5=sim:gps:3:",
12196+
"--serial6=sim:gps:4:",
12197+
])
12198+
12199+
tstart = self.get_sim_time()
12200+
i = 0
12201+
while i < 4:
12202+
if self.get_sim_time_cached() - tstart > 200:
12203+
raise NotAchievedException(f"Did not get GNSS message {i}")
12204+
m = self.assert_receive_message('GNSS')
12205+
if m.id != i:
12206+
continue
12207+
self.dump_message_verbose(m)
12208+
self.assert_message_field_values(m, {
12209+
'satellites_visible': 20 + i + 1,
12210+
'yaw': 0,
12211+
})
12212+
i += 1
12213+
12214+
self.start_subtest("GPS-for-yaw")
12215+
self.set_parameters({
12216+
"SIM_GPS3_HDG": 4,
12217+
"SIM_GPS4_HDG": 2,
12218+
12219+
"GPS3_TYPE": 17, # RTK base
12220+
"GPS3_POS_X": -0.5,
12221+
"GPS3_POS_Y": -0.5,
12222+
"SIM_GPS3_POS_X": -0.5,
12223+
"SIM_GPS3_POS_Y": -0.5,
12224+
12225+
"GPS4_TYPE": 18, # RTK rover
12226+
"GPS4_POS_X": 0.5,
12227+
"GPS4_POS_Y": 0.5,
12228+
"SIM_GPS4_POS_X": 0.5,
12229+
"SIM_GPS4_POS_Y": 0.5,
12230+
})
12231+
self.reboot_sitl()
12232+
12233+
tstart = self.get_sim_time()
12234+
while True:
12235+
if self.get_sim_time_cached() - tstart > 120:
12236+
raise NotAchievedException("Did not get GNSS yaw")
12237+
12238+
m = self.assert_receive_message('GNSS', verbose=True, timeout=120)
12239+
12240+
# if m.id != 4:
12241+
# continue
12242+
12243+
if m.yaw != 0 and m.yaw != 65535:
12244+
self.progress(f"GPS{m.id+1} provided yaw")
12245+
break
12246+
1217112247
def tests2b(self): # this block currently around 9.5mins here
1217212248
'''return list of all tests'''
1217312249
ret = ([
@@ -12246,6 +12322,7 @@ def tests2b(self): # this block currently around 9.5mins here
1224612322
self.RPLidarA2,
1224712323
self.SafetySwitch,
1224812324
self.BrakeZ,
12325+
self.ManyGPS,
1224912326
self.MAV_CMD_DO_FLIGHTTERMINATION,
1225012327
self.MAV_CMD_DO_LAND_START,
1225112328
self.MAV_CMD_SET_EKF_SOURCE_SET,

0 commit comments

Comments
 (0)