Tools: autotest: accept home position before or after ack

autopilot may be out of space or time to send home position packet after
we have requested it
This commit is contained in:
Peter Barker 2019-02-25 14:05:09 +11:00 committed by Peter Barker
parent 6fd687e861
commit 6fc4086726

View File

@ -1689,6 +1689,7 @@ class AutoTest(ABC):
while True: while True:
if self.get_sim_time() - tstart > 30: if self.get_sim_time() - tstart > 30:
raise NotAchievedException("Failed to poll home position") raise NotAchievedException("Failed to poll home position")
self.progress("Sending MAV_CMD_GET_HOME_POSITION")
try: try:
self.run_cmd( self.run_cmd(
mavutil.mavlink.MAV_CMD_GET_HOME_POSITION, mavutil.mavlink.MAV_CMD_GET_HOME_POSITION,
@ -1701,10 +1702,13 @@ class AutoTest(ABC):
0) 0)
except ValueError as e: except ValueError as e:
continue continue
break m = self.mav.messages.get("HOME_POSITION", None)
m = self.mav.messages.get("HOME_POSITION", None) if m is None:
if old is not None and m._timestamp == old._timestamp: continue
raise NotAchievedException("home position not updated") if old is None:
break
if m._timestamp != old._timestamp:
break
return m return m
def distance_to_home(self): def distance_to_home(self):