Skip to content

Commit

Permalink
autotest: Test when invalid item is selected via DO_SET_MISSION_CURRENT
Browse files Browse the repository at this point in the history
  • Loading branch information
nexton-winjeel committed Oct 9, 2023
1 parent 1d309c4 commit cc3eea8
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Tools/autotest/arducopter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3249,6 +3249,31 @@ def FlyMissionTwiceWithReset(self):
self.wait_disarmed()
self.delay_sim_time(20)

def MissionIndexValidity(self):
'''Confirm that attempting to select an invalid mission item is rejected.'''

self.upload_simple_relhome_mission([
(mavutil.mavlink.MAV_CMD_NAV_TAKEOFF, 0, 0, 20),
(mavutil.mavlink.MAV_CMD_NAV_WAYPOINT, 20, 0, 20),
(mavutil.mavlink.MAV_CMD_NAV_RETURN_TO_LAUNCH, 0, 0, 0),
])

num_wp = self.get_mission_count()
accepted_indices = [0, 1, num_wp-1]
denied_indices = [-1, num_wp]

for seq in accepted_indices:
self.run_cmd(mavutil.mavlink.MAV_CMD_DO_SET_MISSION_CURRENT,
p1=seq,
timeout=1,
want_result=mavutil.mavlink.MAV_RESULT_ACCEPTED)

for seq in denied_indices:
self.run_cmd(mavutil.mavlink.MAV_CMD_DO_SET_MISSION_CURRENT,
p1=seq,
timeout=1,
want_result=mavutil.mavlink.MAV_RESULT_DENIED)

def GPSViconSwitching(self):
"""Fly GPS and Vicon switching test"""
self.customise_SITL_commandline(["--uartF=sim:vicon:"])
Expand Down Expand Up @@ -10426,6 +10451,7 @@ def tests2b(self): # this block currently around 9.5mins here
self.ScriptMountPOI,
self.FlyMissionTwice,
self.FlyMissionTwiceWithReset,
self.MissionIndexValidity,
self.IMUConsistency,
self.AHRSTrimLand,
self.GuidedYawRate,
Expand Down

0 comments on commit cc3eea8

Please sign in to comment.