From 8f558609a990158ddeac3c2fcc5e55cb552f38d7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 10 Oct 2013 09:53:51 +1100 Subject: [PATCH] autotest: tweak plane autotest debugging --- Tools/autotest/arduplane.py | 6 ++++++ Tools/autotest/common.py | 22 ++++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Tools/autotest/arduplane.py b/Tools/autotest/arduplane.py index a4c097905e..d73671befe 100644 --- a/Tools/autotest/arduplane.py +++ b/Tools/autotest/arduplane.py @@ -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 diff --git a/Tools/autotest/common.py b/Tools/autotest/common.py index bedae89b61..3a3919c9cc 100644 --- a/Tools/autotest/common.py +++ b/Tools/autotest/common.py @@ -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 @@ -228,4 +230,4 @@ def sim_location(mav): '''return current simulator location''' from pymavlink import mavutil m = mav.recv_match(type='SIMSTATE', blocking=True) - return mavutil.location(m.lat*1.0e-7, m.lng*1.0e-7, 0, math.degrees(m.yaw)) \ No newline at end of file + return mavutil.location(m.lat*1.0e-7, m.lng*1.0e-7, 0, math.degrees(m.yaw))