mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 14:38:30 -04:00
Tools: autotest: add tests for aux-switch options for mission reset and clear
This commit is contained in:
parent
da5d5c9203
commit
23f5fabbcf
@ -3323,6 +3323,39 @@ class AutoTestCopter(AutoTest):
|
||||
if ex is not None:
|
||||
raise ex
|
||||
|
||||
def get_mission_count(self):
|
||||
return self.get_parameter("MIS_TOTAL")
|
||||
|
||||
def assert_mission_count(self, expected):
|
||||
count = self.get_mission_count()
|
||||
if count != expected:
|
||||
raise NotAchievedException("Unexpected count got=%u want=%u" %
|
||||
(count, expected))
|
||||
|
||||
def test_aux_switch_options(self):
|
||||
self.set_parameter("RC7_OPTION", 58) # clear waypoints
|
||||
self.load_mission("copter_loiter_to_alt.txt")
|
||||
self.set_rc(7, 1000)
|
||||
self.assert_mission_count(5)
|
||||
self.progress("Clear mission")
|
||||
self.set_rc(7, 2000)
|
||||
self.assert_mission_count(0)
|
||||
self.set_rc(7, 1000)
|
||||
self.set_parameter("RC7_OPTION", 24) # reset mission
|
||||
self.delay_sim_time(2)
|
||||
self.load_mission("copter_loiter_to_alt.txt")
|
||||
set_wp = 4
|
||||
self.mavproxy.send("wp set %u\n" % set_wp)
|
||||
self.delay_sim_time(1)
|
||||
self.drain_mav()
|
||||
self.wait_current_waypoint(set_wp, timeout=10)
|
||||
self.progress("Reset mission")
|
||||
self.set_rc(7, 2000)
|
||||
self.delay_sim_time(1)
|
||||
self.drain_mav()
|
||||
self.wait_current_waypoint(0, timeout=10)
|
||||
self.set_rc(7, 1000)
|
||||
|
||||
def tests(self):
|
||||
'''return list of all tests'''
|
||||
ret = super(AutoTestCopter, self).tests()
|
||||
@ -3368,6 +3401,10 @@ class AutoTestCopter(AutoTest):
|
||||
"Set modes via auxswitch",
|
||||
self.test_setting_modes_via_auxswitch),
|
||||
|
||||
("AuxSwitchOptions",
|
||||
"Test random aux mode options",
|
||||
self.test_aux_switch_options),
|
||||
|
||||
("AutoTune", "Fly AUTOTUNE mode", self.fly_autotune),
|
||||
|
||||
("ThrowMode", "Fly Throw Mode", self.fly_throw_mode),
|
||||
|
Loading…
Reference in New Issue
Block a user