mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-09 17:38:32 -04:00
autotest: added --viewerip option
this allows you to specify an IP that will receive all MAVLink logs and fg data for realtime viewing
This commit is contained in:
parent
dd96b146b5
commit
dafbdd1f2b
@ -275,8 +275,12 @@ def setup_rc(mavproxy):
|
|||||||
mavproxy.send('rc 3 1000\n')
|
mavproxy.send('rc 3 1000\n')
|
||||||
|
|
||||||
|
|
||||||
def fly_ArduCopter():
|
def fly_ArduCopter(viewerip=None):
|
||||||
'''fly ArduCopter in SIL'''
|
'''fly ArduCopter in SIL
|
||||||
|
|
||||||
|
you can pass viewerip as an IP address to optionally send fg and
|
||||||
|
mavproxy packets too for local viewing of the flight in real time
|
||||||
|
'''
|
||||||
global expect_list, homeloc
|
global expect_list, homeloc
|
||||||
|
|
||||||
sil = util.start_SIL('ArduCopter', wipe=True)
|
sil = util.start_SIL('ArduCopter', wipe=True)
|
||||||
@ -295,12 +299,13 @@ def fly_ArduCopter():
|
|||||||
mavproxy.expect('Loaded [0-9]+ parameters')
|
mavproxy.expect('Loaded [0-9]+ parameters')
|
||||||
|
|
||||||
# reboot with new parameters
|
# reboot with new parameters
|
||||||
print("CLOSING")
|
|
||||||
util.pexpect_close(mavproxy)
|
util.pexpect_close(mavproxy)
|
||||||
util.pexpect_close(sil)
|
util.pexpect_close(sil)
|
||||||
print("CLOSED THEM")
|
|
||||||
sil = util.start_SIL('ArduCopter')
|
sil = util.start_SIL('ArduCopter')
|
||||||
mavproxy = util.start_MAVProxy_SIL('ArduCopter', options='--fgout=127.0.0.1:5502 --fgin=127.0.0.1:5501 --out=127.0.0.1:19550 --out=192.168.2.15:14550 --quadcopter --streamrate=1')
|
options = '--fgout=127.0.0.1:5502 --fgin=127.0.0.1:5501 --out=127.0.0.1:19550 --quadcopter --streamrate=1'
|
||||||
|
if viewerip:
|
||||||
|
options += ' --out=%s:14550' % viewerip
|
||||||
|
mavproxy = util.start_MAVProxy_SIL('ArduCopter', options=options)
|
||||||
mavproxy.expect('Logging to (\S+)')
|
mavproxy.expect('Logging to (\S+)')
|
||||||
logfile = mavproxy.match.group(1)
|
logfile = mavproxy.match.group(1)
|
||||||
print("LOGFILE %s" % logfile)
|
print("LOGFILE %s" % logfile)
|
||||||
@ -317,8 +322,10 @@ def fly_ArduCopter():
|
|||||||
util.expect_setup_callback(mavproxy, expect_callback)
|
util.expect_setup_callback(mavproxy, expect_callback)
|
||||||
|
|
||||||
# start hil_quad.py
|
# start hil_quad.py
|
||||||
hquad = pexpect.spawn(util.reltopdir('../HILTest/hil_quad.py') + ' --fgout=192.168.2.15:9123 --fgrate=200 --home=%s' % HOME_LOCATION,
|
cmd = util.reltopdir('../HILTest/hil_quad.py') + ' --fgrate=200 --home=%s' % HOME_LOCATION
|
||||||
logfile=sys.stdout, timeout=10)
|
if viewerip:
|
||||||
|
cmd += ' --fgout=192.168.2.15:9123'
|
||||||
|
hquad = pexpect.spawn(cmd, logfile=sys.stdout, timeout=10)
|
||||||
util.pexpect_autoclose(hquad)
|
util.pexpect_autoclose(hquad)
|
||||||
hquad.expect('Starting at')
|
hquad.expect('Starting at')
|
||||||
|
|
||||||
|
@ -81,6 +81,7 @@ You can get it from git://git.samba.org/tridge/UAV/HILTest.git
|
|||||||
parser = optparse.OptionParser("autotest")
|
parser = optparse.OptionParser("autotest")
|
||||||
parser.add_option("--skip", type='string', default='', help='list of steps to skip (comma separated)')
|
parser.add_option("--skip", type='string', default='', help='list of steps to skip (comma separated)')
|
||||||
parser.add_option("--list", action='store_true', default=False, help='list the available steps')
|
parser.add_option("--list", action='store_true', default=False, help='list the available steps')
|
||||||
|
parser.add_option("--viewerip", default=None, help='IP address to send MAVLink and fg packets to')
|
||||||
|
|
||||||
opts, args = parser.parse_args()
|
opts, args = parser.parse_args()
|
||||||
|
|
||||||
@ -145,7 +146,7 @@ def run_step(step):
|
|||||||
return dump_logs('ArduCopter')
|
return dump_logs('ArduCopter')
|
||||||
|
|
||||||
if step == 'fly.ArduCopter':
|
if step == 'fly.ArduCopter':
|
||||||
return arducopter.fly_ArduCopter()
|
return arducopter.fly_ArduCopter(viewerip=opts.viewerip)
|
||||||
|
|
||||||
if step == 'convertgpx':
|
if step == 'convertgpx':
|
||||||
return convert_gpx()
|
return convert_gpx()
|
||||||
@ -264,6 +265,7 @@ try:
|
|||||||
if not run_tests(steps):
|
if not run_tests(steps):
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
print("INTERRUPT: Stopping child processes ....")
|
||||||
util.pexpect_close_all()
|
util.pexpect_close_all()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
Loading…
Reference in New Issue
Block a user