autotest: ensure we have a VFR_HUD msgs before getting location

This commit is contained in:
Andrew Tridgell 2011-11-10 22:34:54 +11:00
parent 2d204b727b
commit 2436bff853

View File

@ -64,6 +64,9 @@ def get_bearing(loc1, loc2):
def current_location(mav): def current_location(mav):
'''return current location''' '''return current location'''
# ensure we have a position
mav.recv_match(type='VFR_HUD', blocking=True)
mav.recv_match(type='GPS_RAW', blocking=True)
return location(mav.messages['GPS_RAW'].lat, return location(mav.messages['GPS_RAW'].lat,
mav.messages['GPS_RAW'].lon, mav.messages['GPS_RAW'].lon,
mav.messages['VFR_HUD'].alt) mav.messages['VFR_HUD'].alt)