Skip to content

Commit

Permalink
autotest: augment ClearMission to test clearing from current uploader
Browse files Browse the repository at this point in the history
in the same way that we allow a link to re-start an upload by sending mission_count, allow a GCS to clear a mission and cancel current upload if it was the one doing the transfer
  • Loading branch information
peterbarker committed Aug 19, 2024
1 parent ae64b6d commit 5c95228
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions Tools/autotest/rover.py
Original file line number Diff line number Diff line change
Expand Up @@ -3617,6 +3617,51 @@ def ClearMission(self, target_system=1, target_component=1):

self.assert_current_waypoint(0)

self.drain_mav()

self.start_subtest("No clear mission while it is being uploaded by a different node")
mav2 = mavutil.mavlink_connection("tcp:localhost:5763",
robust_parsing=True,
source_system=7,
source_component=7)
self.context_push()
self.context_collect("MISSION_REQUEST")
mav2.mav.mission_count_send(target_system,
target_component,
17,
mavutil.mavlink.MAV_MISSION_TYPE_MISSION)
ack = self.assert_receive_message('MISSION_REQUEST', check_context=True, mav=mav2)
self.context_pop()

self.context_push()
self.context_collect("MISSION_ACK")
self.mav.mav.mission_clear_all_send(
target_system,
target_component,
mavutil.mavlink.MAV_MISSION_TYPE_MISSION
)
ack = self.assert_receive_message('MISSION_ACK', check_context=True)
self.assert_message_field_values(ack, {
"type": mavutil.mavlink.MAV_MISSION_DENIED,
})
self.context_pop()

self.progress("Test cancel upload from second connection")
self.context_push()
self.context_collect("MISSION_ACK")
mav2.mav.mission_clear_all_send(
target_system,
target_component,
mavutil.mavlink.MAV_MISSION_TYPE_MISSION
)
ack = self.assert_receive_message('MISSION_ACK', mav=mav2, check_context=True)
self.assert_message_field_values(ack, {
"type": mavutil.mavlink.MAV_MISSION_ACCEPTED,
})
self.context_pop()
mav2.close()
del mav2

def GCSMission(self):
'''check MAVProxy's waypoint handling of missions'''

Expand Down

0 comments on commit 5c95228

Please sign in to comment.