mirror of https://github.com/ArduPilot/ardupilot
autotest: add basic test that Plane autotune completes
This commit is contained in:
parent
bf425a1edf
commit
5f32fb82e8
|
@ -3064,6 +3064,57 @@ class AutoTestPlane(AutoTest):
|
|||
if ex is not None:
|
||||
raise ex
|
||||
|
||||
def AUTOTUNE(self):
|
||||
self.takeoff(100)
|
||||
self.change_mode('AUTOTUNE')
|
||||
self.context_collect('STATUSTEXT')
|
||||
tstart = self.get_sim_time()
|
||||
axis = "Roll"
|
||||
rc_value = 1000
|
||||
while True:
|
||||
timeout = 600
|
||||
if self.get_sim_time() - tstart > timeout:
|
||||
raise NotAchievedException("Did not complete within %u seconds" % timeout)
|
||||
try:
|
||||
m = self.wait_statustext("%s: Finished" % axis, check_context=True, timeout=0.1)
|
||||
self.progress("Got %s" % str(m))
|
||||
if axis == "Roll":
|
||||
axis = "Pitch"
|
||||
elif axis == "Pitch":
|
||||
break
|
||||
else:
|
||||
raise ValueError("Bug: %s" % axis)
|
||||
except AutoTestTimeoutException:
|
||||
pass
|
||||
self.delay_sim_time(1)
|
||||
|
||||
if rc_value == 1000:
|
||||
rc_value = 2000
|
||||
elif rc_value == 2000:
|
||||
rc_value = 1000
|
||||
elif rc_value == 1000:
|
||||
rc_value = 2000
|
||||
else:
|
||||
raise ValueError("Bug")
|
||||
|
||||
if axis == "Roll":
|
||||
self.set_rc(1, rc_value)
|
||||
self.set_rc(2, 1500)
|
||||
elif axis == "Pitch":
|
||||
self.set_rc(1, 1500)
|
||||
self.set_rc(2, rc_value)
|
||||
else:
|
||||
raise ValueError("Bug")
|
||||
|
||||
tdelta = self.get_sim_time() - tstart
|
||||
self.progress("Finished in %0.1f seconds" % (tdelta,))
|
||||
|
||||
self.set_rc(1, 1500)
|
||||
self.set_rc(2, 1500)
|
||||
|
||||
self.change_mode('FBWA')
|
||||
self.fly_home_land_and_disarm(timeout=tdelta+240)
|
||||
|
||||
def fly_landing_baro_drift(self):
|
||||
|
||||
self.customise_SITL_commandline([], wipe=True)
|
||||
|
@ -3340,6 +3391,10 @@ class AutoTestPlane(AutoTest):
|
|||
"Test MAVProxy can talk FTP to autopilot",
|
||||
self.MAVFTP),
|
||||
|
||||
("AUTOTUNE",
|
||||
"Test AutoTune mode",
|
||||
self.AUTOTUNE),
|
||||
|
||||
("LogUpload",
|
||||
"Log upload",
|
||||
self.log_upload),
|
||||
|
|
Loading…
Reference in New Issue