autotest: remove dependency on pexpect for rover/copter sim

this makes it easier to run on windows
This commit is contained in:
Andrew Tridgell 2013-03-26 08:12:57 +11:00
parent 94463fd91e
commit 57c498b570
1 changed files with 5 additions and 1 deletions

View File

@ -1,6 +1,6 @@
import math
from math import sqrt, acos, cos, pi, sin, atan2
import os, pexpect, sys, time, random
import os, sys, time, random
from rotmat import Vector3, Matrix3
from subprocess import call, check_call,Popen, PIPE
@ -110,6 +110,7 @@ def pexpect_close_all():
def pexpect_drain(p):
'''drain any pending input'''
import pexpect
try:
p.read_nonblocking(1000, timeout=0)
except pexpect.TIMEOUT:
@ -117,6 +118,7 @@ def pexpect_drain(p):
def start_SIL(atype, valgrind=False, wipe=False, height=None):
'''launch a SIL instance'''
import pexpect
cmd=""
if valgrind and os.path.exists('/usr/bin/valgrind'):
cmd += 'valgrind -q --log-file=%s-valgrind.log ' % atype
@ -134,6 +136,7 @@ def start_SIL(atype, valgrind=False, wipe=False, height=None):
def start_MAVProxy_SIL(atype, aircraft=None, setup=False, master='tcp:127.0.0.1:5760',
options=None, logfile=sys.stdout):
'''launch mavproxy connected to a SIL instance'''
import pexpect
global close_list
MAVPROXY = os.getenv('MAVPROXY_CMD', reltopdir('../MAVProxy/mavproxy.py'))
cmd = MAVPROXY + ' --master=%s --out=127.0.0.1:14550' % master
@ -153,6 +156,7 @@ def start_MAVProxy_SIL(atype, aircraft=None, setup=False, master='tcp:127.0.0.1:
def expect_setup_callback(e, callback):
'''setup a callback that is called once a second while waiting for
patterns'''
import pexpect
def _expect_callback(pattern, timeout=e.timeout):
tstart = time.time()
while time.time() < tstart + timeout: