mirror of https://github.com/ArduPilot/ardupilot
Tools: autotest: tidy and fix nav-delay test
This commit is contained in:
parent
5988c3258f
commit
680f78869d
|
@ -1359,13 +1359,20 @@ class AutoTestCopter(AutoTest):
|
||||||
# retrieve mission item and check it:
|
# retrieve mission item and check it:
|
||||||
tried_set = False
|
tried_set = False
|
||||||
while True:
|
while True:
|
||||||
|
self.progress("Requesting item")
|
||||||
|
self.mav.mav.mission_request_send(1,
|
||||||
|
1,
|
||||||
|
seq
|
||||||
|
)
|
||||||
st = self.mav.recv_match(type='MISSION_ITEM',
|
st = self.mav.recv_match(type='MISSION_ITEM',
|
||||||
blocking=True,
|
blocking=True,
|
||||||
timeout=1)
|
timeout=1)
|
||||||
if st is not None:
|
if st is None:
|
||||||
|
continue
|
||||||
|
|
||||||
print("Item: %s" % str(st))
|
print("Item: %s" % str(st))
|
||||||
if (tried_set and
|
if (tried_set and
|
||||||
st.seq == 3 and
|
st.seq == seq and
|
||||||
st.command == command and
|
st.command == command and
|
||||||
st.param2 == hours and
|
st.param2 == hours and
|
||||||
st.param3 == mins and
|
st.param3 == mins and
|
||||||
|
@ -1373,18 +1380,30 @@ class AutoTestCopter(AutoTest):
|
||||||
return
|
return
|
||||||
self.progress("Mission mismatch")
|
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,
|
self.mav.mav.mission_write_partial_list_send(1,
|
||||||
1,
|
1,
|
||||||
3,
|
seq,
|
||||||
3)
|
seq)
|
||||||
m = self.mav.messages.get("MISSION_REQUEST", None)
|
m = self.mav.recv_match(type='MISSION_REQUEST',
|
||||||
if m is not None:
|
blocking=True,
|
||||||
if m.seq == 3:
|
timeout=1)
|
||||||
|
if m is None:
|
||||||
|
continue
|
||||||
|
if m.seq != st.seq:
|
||||||
|
continue
|
||||||
|
break
|
||||||
|
|
||||||
self.progress("Sending absolute-time mission item")
|
self.progress("Sending absolute-time mission item")
|
||||||
|
|
||||||
# we have to change out the delay time...
|
# we have to change out the delay time...
|
||||||
now = self.mav.recv_match(type='SYSTEM_TIME',
|
now = self.mav.messages["SYSTEM_TIME"]
|
||||||
blocking=True)
|
if now is None:
|
||||||
|
raise PreconditionFailedException()
|
||||||
if now.time_unix_usec == 0:
|
if now.time_unix_usec == 0:
|
||||||
raise PreconditionFailedException()
|
raise PreconditionFailedException()
|
||||||
(hours, mins, secs, ms) = self.calc_delay(
|
(hours, mins, secs, ms) = self.calc_delay(
|
||||||
|
@ -1409,11 +1428,10 @@ class AutoTestCopter(AutoTest):
|
||||||
0, # p6
|
0, # p6
|
||||||
0) # p7
|
0) # p7
|
||||||
tried_set = True
|
tried_set = True
|
||||||
self.progress("Requesting item")
|
ack = self.mav.recv_match(type='MISSION_ACK',
|
||||||
self.mav.mav.mission_request_send(1,
|
blocking=True,
|
||||||
1,
|
timeout=1)
|
||||||
3
|
self.progress("Received ack: %s" % str(ack))
|
||||||
)
|
|
||||||
|
|
||||||
def fly_nav_delay_abstime(self):
|
def fly_nav_delay_abstime(self):
|
||||||
'''fly a simple mission that has a delay in it'''
|
'''fly a simple mission that has a delay in it'''
|
||||||
|
|
Loading…
Reference in New Issue