autotest: tweak plane autotest debugging

This commit is contained in:
Andrew Tridgell 2013-10-10 09:53:51 +11:00
parent b3af59cc0c
commit 8f558609a9
2 changed files with 18 additions and 10 deletions

View File

@ -153,6 +153,9 @@ def wait_level_flight(mavproxy, mav, accuracy=5, timeout=30):
'''wait for level flight'''
tstart = time.time()
print("Waiting for level flight")
mavproxy.send('rc 1 1500\n')
mavproxy.send('rc 2 1500\n')
mavproxy.send('rc 4 1500\n')
while time.time() < tstart + timeout:
m = mav.recv_match(type='ATTITUDE', blocking=True)
roll = math.degrees(m.roll)
@ -196,10 +199,13 @@ def axial_left_roll(mavproxy, mav, count=1):
print("Starting roll")
mavproxy.send('rc 1 1000\n')
if not wait_roll(mav, -150, accuracy=90):
mavproxy.send('rc 1 1500\n')
return False
if not wait_roll(mav, 150, accuracy=90):
mavproxy.send('rc 1 1500\n')
return False
if not wait_roll(mav, 0, accuracy=90):
mavproxy.send('rc 1 1500\n')
return False
count -= 1

View File

@ -84,29 +84,31 @@ def wait_groundspeed(mav, gs_min, gs_max, timeout=30):
def wait_roll(mav, roll, accuracy, timeout=30):
'''wait for a given roll in degrees'''
tstart = time.time()
print("Waiting for roll of %u" % roll)
print("Waiting for roll of %d at %s" % (roll, time.ctime()))
while time.time() < tstart + timeout:
m = mav.recv_match(type='ATTITUDE', blocking=True)
p = math.degrees(m.pitch)
r = math.degrees(m.roll)
print("Roll %u" % r)
print("Roll %d Pitch %d" % (r, p))
if math.fabs(r - roll) <= accuracy:
print("Attained roll %u" % roll)
print("Attained roll %d" % roll)
return True
print("Failed to attain roll %u" % roll)
print("Failed to attain roll %d" % roll)
return False
def wait_pitch(mav, pitch, accuracy, timeout=30):
'''wait for a given pitch in degrees'''
tstart = time.time()
print("Waiting for pitch of %u" % pitch)
print("Waiting for pitch of %u at %s" % (pitch, time.ctime()))
while time.time() < tstart + timeout:
m = mav.recv_match(type='ATTITUDE', blocking=True)
r = math.degrees(m.pitch)
print("Pitch %u" % r)
p = math.degrees(m.pitch)
r = math.degrees(m.roll)
print("Pitch %d Roll %d" % (p, r))
if math.fabs(r - pitch) <= accuracy:
print("Attained pitch %u" % pitch)
print("Attained pitch %d" % pitch)
return True
print("Failed to attain pitch %u" % pitch)
print("Failed to attain pitch %d" % pitch)
return False