From 791b1f43e9ee499449ece56c7c7c7f3eb5234939 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Sat, 27 May 2017 11:45:13 +1000 Subject: [PATCH] Tools: allow heli autotest to use different frame --- Tools/autotest/arducopter.py | 16 ++++++++++++---- Tools/autotest/autotest.py | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Tools/autotest/arducopter.py b/Tools/autotest/arducopter.py index 52c2360042..13ee95ab6d 100644 --- a/Tools/autotest/arducopter.py +++ b/Tools/autotest/arducopter.py @@ -1317,18 +1317,26 @@ def fly_ArduCopter(binary, viewerip=None, use_map=False, valgrind=False, gdb=Fal return True -def fly_CopterAVC(binary, viewerip=None, use_map=False, valgrind=False, gdb=False): +def fly_CopterAVC(binary, viewerip=None, use_map=False, valgrind=False, gdb=False, frame=None, params=None): """Fly ArduCopter in SITL for AVC2013 mission.""" global homeloc + if frame is None: + frame = 'heli' + home = "%f,%f,%u,%u" % (AVCHOME.lat, AVCHOME.lng, AVCHOME.alt, AVCHOME.heading) - sitl = util.start_SITL(binary, wipe=True, model='heli', home=home, speedup=speedup_default) + sitl = util.start_SITL(binary, wipe=True, model=frame, home=home, speedup=speedup_default) mavproxy = util.start_MAVProxy_SITL('ArduCopter', options='--sitl=127.0.0.1:5501 --out=127.0.0.1:19550') mavproxy.expect('Received [0-9]+ parameters') # setup test parameters - mavproxy.send("param load %s/default_params/copter-heli.parm\n" % testdir) - mavproxy.expect('Loaded [0-9]+ parameters') + if params is None: + params = vinfo.options["ArduCopter"]["frames"][frame]["default_params_filename"] + if not isinstance(params, list): + params = [params] + for x in params: + mavproxy.send("param load %s\n" % os.path.join(testdir, x)) + mavproxy.expect('Loaded [0-9]+ parameters') mavproxy.send("param set LOG_REPLAY 1\n") mavproxy.send("param set LOG_DISARMED 1\n") time.sleep(3) diff --git a/Tools/autotest/autotest.py b/Tools/autotest/autotest.py index bab0a642bd..382267f2e2 100755 --- a/Tools/autotest/autotest.py +++ b/Tools/autotest/autotest.py @@ -305,7 +305,7 @@ def run_step(step): return arducopter.fly_ArduCopter(binary, viewerip=opts.viewerip, use_map=opts.map, valgrind=opts.valgrind, gdb=opts.gdb, frame=opts.frame) if step == 'fly.CopterAVC': - return arducopter.fly_CopterAVC(binary, viewerip=opts.viewerip, use_map=opts.map, valgrind=opts.valgrind, gdb=opts.gdb) + return arducopter.fly_CopterAVC(binary, viewerip=opts.viewerip, use_map=opts.map, valgrind=opts.valgrind, gdb=opts.gdb, frame=opts.frame) if step == 'fly.ArduPlane': return arduplane.fly_ArduPlane(binary, viewerip=opts.viewerip, use_map=opts.map, valgrind=opts.valgrind, gdb=opts.gdb)