Skip to content

Commit

Permalink
autotest: add test for mission_clear_all message
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker committed Aug 19, 2024
1 parent 54ec26a commit 8e77f85
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion Tools/autotest/rover.py
Original file line number Diff line number Diff line change
Expand Up @@ -3596,16 +3596,38 @@ def drain_self_mav_fn():
raise e
self.reboot_sitl()

def ClearMission(self, target_system=1, target_component=1):
'''check mission clearing'''

self.start_subtest("Clear via mission_clear_all message")
self.upload_simple_relhome_mission([
(mavutil.mavlink.MAV_CMD_NAV_WAYPOINT, 20, 0, 20),
(mavutil.mavlink.MAV_CMD_NAV_WAYPOINT, 20, 0, 20),
(mavutil.mavlink.MAV_CMD_NAV_WAYPOINT, 20, 0, 20),
(mavutil.mavlink.MAV_CMD_NAV_WAYPOINT, 20, 0, 20),
(mavutil.mavlink.MAV_CMD_NAV_WAYPOINT, 20, 0, 20),
])
self.set_current_waypoint(3)

self.mav.mav.mission_clear_all_send(
target_system,
target_component,
mavutil.mavlink.MAV_MISSION_TYPE_MISSION
)

self.assert_current_waypoint(0)

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

target_system = 1
target_component = 1
mavproxy = self.start_mavproxy()
mavproxy.send('wp clear\n')
self.delay_sim_time(1)
if self.get_parameter("MIS_TOTAL") != 0:
raise NotAchievedException("Failed to clear mission")
m = self.assert_receive_message('MISSION_CURRENT', timeout=5)
m = self.assert_receive_message('MISSION_CURRENT', timeout=5, verbose=True)
if m.seq != 0:
raise NotAchievedException("Bad mission current")
self.load_mission_using_mavproxy(mavproxy, "rover-gripper-mission.txt")
Expand Down Expand Up @@ -6830,6 +6852,7 @@ def tests(self):
self.MissionPolyEnabledPreArm,
self.OpticalFlow,
self.RCDuplicateOptionsExist,
self.ClearMission,
])
return ret

Expand Down

0 comments on commit 8e77f85

Please sign in to comment.