Tools: autotest: tidy and fix nav-delay test

This commit is contained in:
Peter Barker 2018-08-16 09:44:32 +10:00 committed by Peter Barker
parent 5988c3258f
commit 680f78869d
1 changed files with 69 additions and 51 deletions

View File

@ -1359,13 +1359,20 @@ class AutoTestCopter(AutoTest):
# retrieve mission item and check it:
tried_set = False
while True:
self.progress("Requesting item")
self.mav.mav.mission_request_send(1,
1,
seq
)
st = self.mav.recv_match(type='MISSION_ITEM',
blocking=True,
timeout=1)
if st is not None:
if st is None:
continue
print("Item: %s" % str(st))
if (tried_set and
st.seq == 3 and
st.seq == seq and
st.command == command and
st.param2 == hours and
st.param3 == mins and
@ -1373,18 +1380,30 @@ class AutoTestCopter(AutoTest):
return
self.progress("Mission mismatch")
m = None
tstart = self.get_sim_time()
while True:
if self.get_sim_time_cached() - tstart > 3:
raise NotAchievedException()
self.mav.mav.mission_write_partial_list_send(1,
1,
3,
3)
m = self.mav.messages.get("MISSION_REQUEST", None)
if m is not None:
if m.seq == 3:
seq,
seq)
m = self.mav.recv_match(type='MISSION_REQUEST',
blocking=True,
timeout=1)
if m is None:
continue
if m.seq != st.seq:
continue
break
self.progress("Sending absolute-time mission item")
# we have to change out the delay time...
now = self.mav.recv_match(type='SYSTEM_TIME',
blocking=True)
now = self.mav.messages["SYSTEM_TIME"]
if now is None:
raise PreconditionFailedException()
if now.time_unix_usec == 0:
raise PreconditionFailedException()
(hours, mins, secs, ms) = self.calc_delay(
@ -1409,11 +1428,10 @@ class AutoTestCopter(AutoTest):
0, # p6
0) # p7
tried_set = True
self.progress("Requesting item")
self.mav.mav.mission_request_send(1,
1,
3
)
ack = self.mav.recv_match(type='MISSION_ACK',
blocking=True,
timeout=1)
self.progress("Received ack: %s" % str(ack))
def fly_nav_delay_abstime(self):
'''fly a simple mission that has a delay in it'''