def run_step(step): '''run one step''' if step == "prerequesites": return test_prerequesites() if step == 'build.ArduPlane': return util.build_SIL('ArduPlane') if step == 'build.APMrover2': return util.build_SIL('APMrover2') if step == 'build.ArduCopter': return util.build_SIL('ArduCopter') if step == 'build2560.ArduCopter': return util.build_AVR('ArduCopter', board='mega2560') if step == 'build2560.ArduPlane': return util.build_AVR('ArduPlane', board='mega2560') if step == 'build2560.APMrover2': return util.build_AVR('APMrover2', board='mega2560') if step == 'defaults.ArduPlane': return get_default_params('ArduPlane') if step == 'defaults.ArduCopter': return get_default_params('ArduCopter') if step == 'defaults.APMrover2': return get_default_params('APMrover2') if step == 'fly.ArduCopter': return arducopter.fly_ArduCopter(viewerip=opts.viewerip, map=opts.map) if step == 'fly.CopterAVC': return arducopter.fly_CopterAVC(viewerip=opts.viewerip, map=opts.map) if step == 'fly.ArduPlane': return arduplane.fly_ArduPlane(viewerip=opts.viewerip, map=opts.map) if step == 'drive.APMrover2': return apmrover2.drive_APMrover2(viewerip=opts.viewerip, map=opts.map, console=opts.console) if step == 'build.All': return build_all() if step == 'build.Binaries': return build_binaries() if step == 'build.Examples': return build_examples() if step == 'build.Parameters': return build_parameters() if step == 'convertgpx': return convert_gpx() raise RuntimeError("Unknown step %s" % step)
def fly_CopterAVC(viewerip=None, map=False): '''fly ArduCopter in SIL for AVC2013 mission ''' global homeloc if TARGET != 'sitl': util.build_SIL('ArduCopter', target=TARGET) home = "%f,%f,%u,%u" % (AVCHOME.lat, AVCHOME.lng, AVCHOME.alt, AVCHOME.heading) sil = util.start_SIL('ArduCopter', wipe=True, model='heli', home=home, speedup=speedup_default) mavproxy = util.start_MAVProxy_SIL('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/Helicopter.parm\n" % testdir) mavproxy.expect('Loaded [0-9]+ parameters') # reboot with new parameters util.pexpect_close(mavproxy) util.pexpect_close(sil) sil = util.start_SIL('ArduCopter', model='heli', home=home, speedup=speedup_default) options = '--sitl=127.0.0.1:5501 --out=127.0.0.1:19550 --streamrate=5' if viewerip: options += ' --out=%s:14550' % viewerip if map: options += ' --map' mavproxy = util.start_MAVProxy_SIL('ArduCopter', options=options) mavproxy.expect('Telemetry log: (\S+)') logfile = mavproxy.match.group(1) print("LOGFILE %s" % logfile) buildlog = util.reltopdir("../buildlogs/CopterAVC-test.tlog") print("buildlog=%s" % buildlog) if os.path.exists(buildlog): os.unlink(buildlog) try: os.link(logfile, buildlog) except Exception: pass # the received parameters can come before or after the ready to fly message mavproxy.expect(['Received [0-9]+ parameters', 'Ready to FLY']) mavproxy.expect(['Received [0-9]+ parameters', 'Ready to FLY']) util.expect_setup_callback(mavproxy, expect_callback) expect_list_clear() expect_list_extend([sil, mavproxy]) if map: mavproxy.send('map icon 40.072467969730496 -105.2314389590174\n') mavproxy.send('map icon 40.072600990533829 -105.23146100342274\n') # get a mavlink connection going try: mav = mavutil.mavlink_connection('127.0.0.1:19550', robust_parsing=True) except Exception, msg: print("Failed to start mavlink connection on 127.0.0.1:19550" % msg) raise
def run_step(step): '''run one step''' # remove old logs util.run_cmd('/bin/rm -f logs/*.BIN logs/LASTLOG.TXT') if step == "prerequisites": return test_prerequisites() if step == 'build.ArduPlane': return util.build_SIL('ArduPlane') if step == 'build.APMrover2': return util.build_SIL('APMrover2') if step == 'build.ArduCopter': return util.build_SIL('ArduCopter') if step == 'defaults.ArduPlane': return get_default_params('ArduPlane') if step == 'defaults.ArduCopter': return get_default_params('ArduCopter') if step == 'defaults.APMrover2': return get_default_params('APMrover2') if step == 'fly.ArduCopter': return arducopter.fly_ArduCopter(viewerip=opts.viewerip, map=opts.map) if step == 'fly.CopterAVC': return arducopter.fly_CopterAVC(viewerip=opts.viewerip, map=opts.map) if step == 'fly.ArduPlane': return arduplane.fly_ArduPlane(viewerip=opts.viewerip, map=opts.map) if step == 'drive.APMrover2': return apmrover2.drive_APMrover2(viewerip=opts.viewerip, map=opts.map) if step == 'build.All': return build_all() if step == 'build.Binaries': return build_binaries() if step == 'build.DevRelease': return build_devrelease() if step == 'build.Examples': return build_examples() if step == 'build.Parameters': return build_parameters() if step == 'convertgpx': return convert_gpx() raise RuntimeError("Unknown step %s" % step)
def run_step(step): # Process any flags to be passed into build myFlags=None if opts.incremental == True: myFlags = { 'incremental': True } '''run one step''' if step == "prerequesites": return test_prerequesites() if step == 'build.ArduPlane': return util.build_SIL('ArduPlane', flags=myFlags) if step == 'build.ArduCopter': return util.build_SIL('ArduCopter', flags=myFlags ) if step == 'build2560.ArduCopter': return util.build_AVR('ArduCopter', board='mega2560') if step == 'build2560.ArduPlane': return util.build_AVR('ArduPlane', board='mega2560') if step == 'defaults.ArduPlane': return get_default_params('ArduPlane') if step == 'defaults.ArduCopter': return get_default_params('ArduCopter') if step == 'fly.ArduCopter': return arducopter.fly_ArduCopter(viewerip=opts.viewerip, map=opts.map) if step == 'fly.CopterAVC': return arducopter.fly_CopterAVC(viewerip=opts.viewerip, map=opts.map) if step == 'fly.ArduPlane': return arduplane.fly_ArduPlane(viewerip=opts.viewerip, map=opts.map) if step == 'build.All': return build_all() if step == 'build.Binaries': return build_binaries() if step == 'build.Examples': return build_examples() if step == 'build.Parameters': return build_parameters() if step == 'convertgpx': return convert_gpx() raise RuntimeError("Unknown step %s" % step)
def run_step(step): '''run one step''' if step == "prerequesites": return test_prerequesites() if step == 'build.ArduPlane': return util.build_SIL('ArduPlane') if step == 'build.ArduCopter': return util.build_SIL('ArduCopter') if step == 'build1280.ArduCopter': return util.build_AVR('ArduCopter', board='mega') if step == 'build2560.ArduCopter': return util.build_AVR('ArduCopter', board='mega2560') if step == 'build1280.ArduPlane': return util.build_AVR('ArduPlane', board='mega') if step == 'build2560.ArduPlane': return util.build_AVR('ArduPlane', board='mega2560') if step == 'defaults.ArduPlane': return get_default_params('ArduPlane') if step == 'defaults.ArduCopter': return get_default_params('ArduCopter') if step == 'logs.ArduPlane': return dump_logs('ArduPlane') if step == 'logs.ArduCopter': return dump_logs('ArduCopter') if step == 'fly.ArduCopter': return arducopter.fly_ArduCopter(viewerip=opts.viewerip) if step == 'fly.ArduPlane': return arduplane.fly_ArduPlane(viewerip=opts.viewerip) if step == 'build.All': return build_all() if step == 'convertgpx': return convert_gpx() raise RuntimeError("Unknown step %s" % step)
def run_step(step): '''run one step''' if step == "prerequesites": return test_prerequesites() if step == 'build.ArduPlane': return util.build_SIL('ArduPlane') if step == 'build.ArduCopter': return util.build_SIL('ArduCopter') if step == 'build1280.ArduCopter': return util.build_AVR('ArduCopter', board='mega') if step == 'build2560.ArduCopter': return util.build_AVR('ArduCopter', board='mega2560') if step == 'build1280.ArduPlane': return util.build_AVR('ArduPlane', board='mega') if step == 'build2560.ArduPlane': return util.build_AVR('ArduPlane', board='mega2560') if step == 'defaults.ArduPlane': return get_default_params('ArduPlane') if step == 'defaults.ArduCopter': return get_default_params('ArduCopter') if step == 'logs.ArduPlane': return dump_logs('ArduPlane') if step == 'logs.ArduCopter': return dump_logs('ArduCopter') if step == 'fly.ArduCopter': return arducopter.fly_ArduCopter(viewerip=opts.viewerip) if step == 'fly.ArduPlane': if not opts.experimental: print("DISABLED: use --experimental to enable fly.ArduPlane") return True return arduplane.fly_ArduPlane(viewerip=opts.viewerip) if step == 'convertgpx': return convert_gpx() raise RuntimeError("Unknown step %s" % step)
def fly_ArduCopter(viewerip=None): '''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 homeloc if TARGET != 'sitl': util.build_SIL('ArduCopter', target=TARGET) sim_cmd = util.reltopdir('Tools/autotest/pysim/sim_multicopter.py') + ' --frame=%s --rate=400 --home=%f,%f,%u,%u' % ( FRAME, HOME.lat, HOME.lng, HOME.alt, HOME.heading) sim_cmd += ' --wind=6,45,.3' if viewerip: sim_cmd += ' --fgout=%s:5503' % viewerip sil = util.start_SIL('ArduCopter', wipe=True) mavproxy = util.start_MAVProxy_SIL('ArduCopter', options='--sitl=127.0.0.1:5501 --out=127.0.0.1:19550 --quadcopter') mavproxy.expect('Received [0-9]+ parameters') # setup test parameters mavproxy.send('param set SYSID_THISMAV %u\n' % random.randint(100, 200)) mavproxy.send("param load %s/ArduCopter.parm\n" % testdir) mavproxy.expect('Loaded [0-9]+ parameters') # reboot with new parameters util.pexpect_close(mavproxy) util.pexpect_close(sil) sil = util.start_SIL('ArduCopter', height=HOME.alt) sim = pexpect.spawn(sim_cmd, logfile=sys.stdout, timeout=10) sim.delaybeforesend = 0 util.pexpect_autoclose(sim) options = '--sitl=127.0.0.1:5501 --out=127.0.0.1:19550 --quadcopter --streamrate=5' if viewerip: options += ' --out=%s:14550' % viewerip mavproxy = util.start_MAVProxy_SIL('ArduCopter', options=options) mavproxy.expect('Logging to (\S+)') logfile = mavproxy.match.group(1) print("LOGFILE %s" % logfile) buildlog = util.reltopdir("../buildlogs/ArduCopter-test.mavlog") print("buildlog=%s" % buildlog) if os.path.exists(buildlog): os.unlink(buildlog) os.link(logfile, buildlog) # the received parameters can come before or after the ready to fly message mavproxy.expect(['Received [0-9]+ parameters', 'Ready to FLY']) mavproxy.expect(['Received [0-9]+ parameters', 'Ready to FLY']) util.expect_setup_callback(mavproxy, expect_callback) expect_list_clear() expect_list_extend([sim, sil, mavproxy]) # get a mavlink connection going try: mav = mavutil.mavlink_connection('127.0.0.1:19550', robust_parsing=True) except Exception, msg: print("Failed to start mavlink connection on 127.0.0.1:19550" % msg) raise
def fly_CopterAVC(viewerip=None, map=False): '''fly ArduCopter in SIL for AVC2013 mission ''' global homeloc if TARGET != 'sitl': util.build_SIL('ArduCopter', target=TARGET) sim_cmd = util.reltopdir('Tools/autotest/pysim/sim_multicopter.py') + ' --frame=%s --rate=400 --home=%f,%f,%u,%u' % ( FRAME, AVCHOME.lat, AVCHOME.lng, AVCHOME.alt, AVCHOME.heading) if viewerip: sim_cmd += ' --fgout=%s:5503' % viewerip sil = util.start_SIL('ArduCopter', wipe=True) mavproxy = util.start_MAVProxy_SIL('ArduCopter', options='--sitl=127.0.0.1:5501 --out=127.0.0.1:19550 --quadcopter') mavproxy.expect('Received [0-9]+ parameters') # setup test parameters mavproxy.send("param load %s/copter_AVC2013_params.parm\n" % testdir) mavproxy.expect('Loaded [0-9]+ parameters') # reboot with new parameters util.pexpect_close(mavproxy) util.pexpect_close(sil) sil = util.start_SIL('ArduCopter', height=HOME.alt) sim = pexpect.spawn(sim_cmd, logfile=sys.stdout, timeout=10) sim.delaybeforesend = 0 util.pexpect_autoclose(sim) options = '--sitl=127.0.0.1:5501 --out=127.0.0.1:19550 --quadcopter --streamrate=5' if viewerip: options += ' --out=%s:14550' % viewerip if map: options += ' --map' mavproxy = util.start_MAVProxy_SIL('ArduCopter', options=options) mavproxy.expect('Logging to (\S+)') logfile = mavproxy.match.group(1) print("LOGFILE %s" % logfile) buildlog = util.reltopdir("../buildlogs/CopterAVC-test.tlog") print("buildlog=%s" % buildlog) if os.path.exists(buildlog): os.unlink(buildlog) try: os.link(logfile, buildlog) except Exception: pass # the received parameters can come before or after the ready to fly message mavproxy.expect(['Received [0-9]+ parameters', 'Ready to FLY']) mavproxy.expect(['Received [0-9]+ parameters', 'Ready to FLY']) util.expect_setup_callback(mavproxy, expect_callback) expect_list_clear() expect_list_extend([sim, sil, mavproxy]) if map: mavproxy.send('map icon 40.072467969730496 -105.2314389590174\n') mavproxy.send('map icon 40.072600990533829 -105.23146100342274\n') # get a mavlink connection going try: mav = mavutil.mavlink_connection('127.0.0.1:19550', robust_parsing=True) except Exception, msg: print("Failed to start mavlink connection on 127.0.0.1:19550" % msg) raise
def fly_ArduCopter(viewerip=None, map=False): '''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 homeloc if TARGET != 'sitl': util.build_SIL('ArduCopter', target=TARGET) home = "%f,%f,%u,%u" % (HOME.lat, HOME.lng, HOME.alt, HOME.heading) sil = util.start_SIL('ArduCopter', wipe=True, model='+', home=home, speedup=speedup_default) mavproxy = util.start_MAVProxy_SIL('ArduCopter', options='--sitl=127.0.0.1:5501 --out=127.0.0.1:19550 --quadcopter') mavproxy.expect('Received [0-9]+ parameters') # setup test parameters mavproxy.send("param load %s/copter_params.parm\n" % testdir) mavproxy.expect('Loaded [0-9]+ parameters') # reboot with new parameters util.pexpect_close(mavproxy) util.pexpect_close(sil) sil = util.start_SIL('ArduCopter', model='+', home=home, speedup=speedup_default) options = '--sitl=127.0.0.1:5501 --out=127.0.0.1:19550 --quadcopter --streamrate=5' if viewerip: options += ' --out=%s:14550' % viewerip if map: options += ' --map' mavproxy = util.start_MAVProxy_SIL('ArduCopter', options=options) mavproxy.expect('Telemetry log: (\S+)') logfile = mavproxy.match.group(1) print("LOGFILE %s" % logfile) buildlog = util.reltopdir("../buildlogs/ArduCopter-test.tlog") print("buildlog=%s" % buildlog) copyTLog = False if os.path.exists(buildlog): os.unlink(buildlog) try: os.link(logfile, buildlog) except Exception: print( "WARN: Failed to create symlink: " + logfile + " => " + buildlog + ", Will copy tlog manually to target location" ) copyTLog = True # the received parameters can come before or after the ready to fly message mavproxy.expect(['Received [0-9]+ parameters', 'Ready to FLY']) mavproxy.expect(['Received [0-9]+ parameters', 'Ready to FLY']) util.expect_setup_callback(mavproxy, expect_callback) expect_list_clear() expect_list_extend([sil, mavproxy]) # get a mavlink connection going try: mav = mavutil.mavlink_connection('127.0.0.1:19550', robust_parsing=True) except Exception, msg: print("Failed to start mavlink connection on 127.0.0.1:19550" % msg) raise
def run_step(step): '''run one step''' # remove old logs util.run_cmd('/bin/rm -f logs/*.BIN logs/LASTLOG.TXT') if step == "prerequisites": return test_prerequisites() if step == 'build.ArduPlane': return util.build_SIL('bin/arduplane', j=opts.j, debug=opts.debug) if step == 'build.APMrover2': return util.build_SIL('bin/ardurover', j=opts.j, debug=opts.debug) if step == 'build.ArduCopter': return util.build_SIL('bin/arducopter-quad', j=opts.j, debug=opts.debug) if step == 'build.AntennaTracker': return util.build_SIL('bin/antennatracker', j=opts.j, debug=opts.debug) if step == 'build.Helicopter': return util.build_SIL('bin/arducopter-heli', j=opts.j, debug=opts.debug) binary = binary_path(step, debug=opts.debug) if step == 'defaults.ArduPlane': return get_default_params('ArduPlane', binary) if step == 'defaults.ArduCopter': return get_default_params('ArduCopter', binary) if step == 'defaults.APMrover2': return get_default_params('APMrover2', binary) if step == 'fly.ArduCopter': return arducopter.fly_ArduCopter(binary, viewerip=opts.viewerip, map=opts.map, valgrind=opts.valgrind, gdb=opts.gdb) if step == 'fly.CopterAVC': return arducopter.fly_CopterAVC(binary, viewerip=opts.viewerip, map=opts.map, valgrind=opts.valgrind, gdb=opts.gdb) if step == 'fly.ArduPlane': return arduplane.fly_ArduPlane(binary, viewerip=opts.viewerip, map=opts.map, valgrind=opts.valgrind, gdb=opts.gdb) if step == 'fly.QuadPlane': return quadplane.fly_QuadPlane(binary, viewerip=opts.viewerip, map=opts.map, valgrind=opts.valgrind, gdb=opts.gdb) if step == 'drive.APMrover2': return apmrover2.drive_APMrover2(binary, viewerip=opts.viewerip, map=opts.map, valgrind=opts.valgrind, gdb=opts.gdb) if step == 'build.All': return build_all() if step == 'build.Binaries': return build_binaries() if step == 'build.DevRelease': return build_devrelease() if step == 'build.Examples': return build_examples() if step == 'build.Parameters': return build_parameters() if step == 'convertgpx': return convert_gpx() raise RuntimeError("Unknown step %s" % step)
def run_step(step): '''run one step''' # remove old logs util.run_cmd('/bin/rm -f logs/*.BIN logs/LASTLOG.TXT') if step == "prerequisites": return test_prerequisites() if step == 'build.ArduPlane': return util.build_SIL('ArduPlane', j=opts.j) if step == 'build.APMrover2': return util.build_SIL('APMrover2', j=opts.j) if step == 'build.ArduCopter': return util.build_SIL('ArduCopter', j=opts.j) if step == 'build.AntennaTracker': return util.build_SIL('AntennaTracker', j=opts.j) if step == 'build.Helicopter': return util.build_SIL('ArduCopter', target='sitl-heli', j=opts.j) if step == 'defaults.ArduPlane': return get_default_params('ArduPlane') if step == 'defaults.ArduCopter': return get_default_params('ArduCopter') if step == 'defaults.APMrover2': return get_default_params('APMrover2') if step == 'fly.ArduCopter': return arducopter.fly_ArduCopter(viewerip=opts.viewerip, map=opts.map) if step == 'fly.CopterAVC': return arducopter.fly_CopterAVC(viewerip=opts.viewerip, map=opts.map) if step == 'fly.ArduPlane': return arduplane.fly_ArduPlane(viewerip=opts.viewerip, map=opts.map) if step == 'drive.APMrover2': return apmrover2.drive_APMrover2(viewerip=opts.viewerip, map=opts.map) if step == 'build.All': return build_all() if step == 'build.Binaries': return build_binaries() if step == 'build.DevRelease': return build_devrelease() if step == 'build.Examples': return build_examples() if step == 'build.Parameters': return build_parameters() if step == 'convertgpx': return convert_gpx() raise RuntimeError("Unknown step %s" % step)
def fly_CopterAVC(viewerip=None, map=False): '''fly ArduCopter in SIL for AVC2013 mission ''' global homeloc if TARGET != 'sitl': util.build_SIL('ArduCopter', target=TARGET) home = "%f,%f,%u,%u" % (AVCHOME.lat, AVCHOME.lng, AVCHOME.alt, AVCHOME.heading) sil = util.start_SIL('ArduCopter', wipe=True, model='heli', home=home, speedup=speedup_default) mavproxy = util.start_MAVProxy_SIL( '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/Helicopter.parm\n" % testdir) mavproxy.expect('Loaded [0-9]+ parameters') # reboot with new parameters util.pexpect_close(mavproxy) util.pexpect_close(sil) sil = util.start_SIL('ArduCopter', model='heli', home=home, speedup=speedup_default) options = '--sitl=127.0.0.1:5501 --out=127.0.0.1:19550 --streamrate=5' if viewerip: options += ' --out=%s:14550' % viewerip if map: options += ' --map' mavproxy = util.start_MAVProxy_SIL('ArduCopter', options=options) mavproxy.expect('Telemetry log: (\S+)') logfile = mavproxy.match.group(1) print("LOGFILE %s" % logfile) buildlog = util.reltopdir("../buildlogs/CopterAVC-test.tlog") print("buildlog=%s" % buildlog) if os.path.exists(buildlog): os.unlink(buildlog) try: os.link(logfile, buildlog) except Exception: pass # the received parameters can come before or after the ready to fly message mavproxy.expect(['Received [0-9]+ parameters', 'Ready to FLY']) mavproxy.expect(['Received [0-9]+ parameters', 'Ready to FLY']) util.expect_setup_callback(mavproxy, expect_callback) expect_list_clear() expect_list_extend([sil, mavproxy]) if map: mavproxy.send('map icon 40.072467969730496 -105.2314389590174\n') mavproxy.send('map icon 40.072600990533829 -105.23146100342274\n') # get a mavlink connection going try: mav = mavutil.mavlink_connection('127.0.0.1:19550', robust_parsing=True) except Exception, msg: print("Failed to start mavlink connection on 127.0.0.1:19550" % msg) raise
def run_step(step): """run one step""" # remove old logs util.run_cmd("/bin/rm -f logs/*.BIN logs/LASTLOG.TXT") if step == "prerequisites": return test_prerequisites() if step == "build.ArduPlane": return util.build_SIL("ArduPlane") if step == "build.APMrover2": return util.build_SIL("APMrover2") if step == "build.ArduCopter": return util.build_SIL("ArduCopter") if step == "build2560.ArduCopter": return util.build_AVR("ArduCopter", board="mega2560") if step == "build2560.ArduPlane": return util.build_AVR("ArduPlane", board="mega2560") if step == "build2560.APMrover2": return util.build_AVR("APMrover2", board="mega2560") if step == "defaults.ArduPlane": return get_default_params("ArduPlane") if step == "defaults.ArduCopter": return get_default_params("ArduCopter") if step == "defaults.APMrover2": return get_default_params("APMrover2") if step == "fly.ArduCopter": return arducopter.fly_ArduCopter(viewerip=opts.viewerip, map=opts.map) if step == "fly.CopterAVC": return arducopter.fly_CopterAVC(viewerip=opts.viewerip, map=opts.map) if step == "fly.ArduPlane": return arduplane.fly_ArduPlane(viewerip=opts.viewerip, map=opts.map) if step == "drive.APMrover2": return apmrover2.drive_APMrover2(viewerip=opts.viewerip, map=opts.map) if step == "build.All": return build_all() if step == "build.Binaries": return build_binaries() if step == "build.DevRelease": return build_devrelease() if step == "build.Examples": return build_examples() if step == "build.Parameters": return build_parameters() if step == "convertgpx": return convert_gpx() raise RuntimeError("Unknown step %s" % step)
def fly_CopterAVC(viewerip=None, map=False): """fly ArduCopter in SIL for AVC2013 mission """ global homeloc if TARGET != "sitl": util.build_SIL("ArduCopter", target=TARGET) sim_cmd = util.reltopdir("Tools/autotest/pysim/sim_multicopter.py") + " --frame=%s --home=%f,%f,%u,%u" % ( FRAME, AVCHOME.lat, AVCHOME.lng, AVCHOME.alt, AVCHOME.heading, ) if viewerip: sim_cmd += " --fgout=%s:5505" % viewerip sim = pexpect.spawn(sim_cmd, logfile=sys.stdout, timeout=10) sim.delaybeforesend = 0 util.pexpect_autoclose(sim) sil = util.start_SIL("ArduCopter", wipe=True) mavproxy = util.start_MAVProxy_SIL("ArduCopter", options="--sitl=127.0.0.1:5501 --out=127.0.0.1:19550 --quadcopter") mavproxy.expect("Received [0-9]+ parameters") # setup test parameters mavproxy.send("param load %s/copter_AVC2013_params.parm\n" % testdir) # mavproxy.send("param load %s/copter_params.parm\n" % testdir) mavproxy.expect("Loaded [0-9]+ parameters") # reboot with new parameters util.pexpect_close(mavproxy) util.pexpect_close(sil) sil = util.start_SIL("ArduCopter", height=HOME.alt) options = "--sitl=127.0.0.1:5501 --out=127.0.0.1:19550 --quadcopter --streamrate=5" if viewerip: options += " --out=%s:14550" % viewerip if map: options += " --map" mavproxy = util.start_MAVProxy_SIL("ArduCopter", options=options) mavproxy.expect("Logging to (\S+)") logfile = mavproxy.match.group(1) print("LOGFILE %s" % logfile) buildlog = util.reltopdir("../buildlogs/CopterAVC-test.tlog") print("buildlog=%s" % buildlog) if os.path.exists(buildlog): os.unlink(buildlog) try: os.link(logfile, buildlog) except Exception: pass # the received parameters can come before or after the ready to fly message mavproxy.expect(["Received [0-9]+ parameters", "Ready to FLY"]) mavproxy.expect(["Received [0-9]+ parameters", "Ready to FLY"]) util.expect_setup_callback(mavproxy, expect_callback) expect_list_clear() expect_list_extend([sim, sil, mavproxy]) if map: mavproxy.send("map icon 40.072467969730496 -105.2314389590174\n") mavproxy.send("map icon 40.072600990533829 -105.23146100342274\n") # get a mavlink connection going try: mav = mavutil.mavlink_connection("127.0.0.1:19550", robust_parsing=True) except Exception, msg: print("Failed to start mavlink connection on 127.0.0.1:19550" % msg) raise
def run_step(step): """run one step""" # remove old logs util.run_cmd("/bin/rm -f logs/*.BIN logs/LASTLOG.TXT") if step == "prerequisites": return test_prerequisites() if step == "build.ArduPlane": return util.build_SIL("bin/arduplane", j=opts.j, debug=opts.debug) if step == "build.APMrover2": return util.build_SIL("bin/ardurover", j=opts.j, debug=opts.debug) if step == "build.ArduCopter": return util.build_SIL("bin/arducopter-quad", j=opts.j, debug=opts.debug) if step == "build.AntennaTracker": return util.build_SIL("bin/antennatracker", j=opts.j, debug=opts.debug) if step == "build.Helicopter": return util.build_SIL("bin/arducopter-heli", j=opts.j, debug=opts.debug) binary = binary_path(step, debug=opts.debug) if step == "defaults.ArduPlane": return get_default_params("ArduPlane", binary) if step == "defaults.ArduCopter": return get_default_params("ArduCopter", binary) if step == "defaults.APMrover2": return get_default_params("APMrover2", binary) if step == "fly.ArduCopter": return arducopter.fly_ArduCopter( binary, viewerip=opts.viewerip, use_map=opts.map, valgrind=opts.valgrind, gdb=opts.gdb ) if step == "fly.CopterAVC": return arducopter.fly_CopterAVC( binary, viewerip=opts.viewerip, map=opts.map, valgrind=opts.valgrind, gdb=opts.gdb ) if step == "fly.ArduPlane": return arduplane.fly_ArduPlane( binary, viewerip=opts.viewerip, map=opts.map, valgrind=opts.valgrind, gdb=opts.gdb ) if step == "fly.QuadPlane": return quadplane.fly_QuadPlane( binary, viewerip=opts.viewerip, map=opts.map, valgrind=opts.valgrind, gdb=opts.gdb ) if step == "drive.APMrover2": return apmrover2.drive_APMrover2( binary, viewerip=opts.viewerip, map=opts.map, valgrind=opts.valgrind, gdb=opts.gdb ) if step == "build.All": return build_all() if step == "build.Binaries": return build_binaries() if step == "build.DevRelease": return build_devrelease() if step == "build.Examples": return build_examples() if step == "build.Parameters": return build_parameters() if step == "convertgpx": return convert_gpx() raise RuntimeError("Unknown step %s" % step)
def fly_CopterAVC(viewerip=None, map=False): '''fly ArduCopter in SIL for AVC2013 mission ''' global homeloc if TARGET != 'sitl': util.build_SIL('ArduCopter', target=TARGET) sim_cmd = util.reltopdir('Tools/autotest/pysim/sim_multicopter.py') + ' --frame=%s --rate=400 --home=%f,%f,%u,%u' % ( FRAME, AVCHOME.lat, AVCHOME.lng, AVCHOME.alt, AVCHOME.heading) if viewerip: sim_cmd += ' --fgout=%s:5503' % viewerip sil = util.start_SIL('ArduCopter', wipe=True) mavproxy = util.start_MAVProxy_SIL('ArduCopter', options='--sitl=127.0.0.1:5501 --out=127.0.0.1:19550 --quadcopter') mavproxy.expect('Received [0-9]+ parameters') # setup test parameters mavproxy.send('param set SYSID_THISMAV %u\n' % random.randint(100, 200)) mavproxy.send("param load %s/CopterAVC.parm\n" % testdir) mavproxy.expect('Loaded [0-9]+ parameters') # reboot with new parameters util.pexpect_close(mavproxy) util.pexpect_close(sil) sil = util.start_SIL('ArduCopter', height=HOME.alt) sim = pexpect.spawn(sim_cmd, logfile=sys.stdout, timeout=10) sim.delaybeforesend = 0 util.pexpect_autoclose(sim) options = '--sitl=127.0.0.1:5501 --out=127.0.0.1:19550 --quadcopter --streamrate=5' if viewerip: options += ' --out=%s:14550' % viewerip if map: options += ' --map' mavproxy = util.start_MAVProxy_SIL('ArduCopter', options=options) mavproxy.expect('Logging to (\S+)') logfile = mavproxy.match.group(1) print("LOGFILE %s" % logfile) buildlog = util.reltopdir("../buildlogs/CopterAVC-test.tlog") print("buildlog=%s" % buildlog) if os.path.exists(buildlog): os.unlink(buildlog) os.link(logfile, buildlog) # the received parameters can come before or after the ready to fly message mavproxy.expect(['Received [0-9]+ parameters', 'Ready to FLY']) mavproxy.expect(['Received [0-9]+ parameters', 'Ready to FLY']) util.expect_setup_callback(mavproxy, expect_callback) expect_list_clear() expect_list_extend([sim, sil, mavproxy]) if map: mavproxy.send('map icon 40.072467969730496 -105.2314389590174\n') mavproxy.send('map icon 40.072600990533829 -105.23146100342274\n') # get a mavlink connection going try: mav = mavutil.mavlink_connection('127.0.0.1:19550', robust_parsing=True) except Exception, msg: print("Failed to start mavlink connection on 127.0.0.1:19550" % msg) raise
def fly_ArduCopter(viewerip=None): '''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 homeloc if TARGET != 'sitl': util.build_SIL('ArduCopter', target=TARGET) sim_cmd = util.reltopdir( 'Tools/autotest/pysim/sim_multicopter.py' ) + ' --frame=%s --rate=400 --home=%f,%f,%u,%u' % ( FRAME, HOME.lat, HOME.lng, HOME.alt, HOME.heading) sim_cmd += ' --wind=6,45,.3' if viewerip: sim_cmd += ' --fgout=%s:5503' % viewerip sil = util.start_SIL('ArduCopter', wipe=True) mavproxy = util.start_MAVProxy_SIL( 'ArduCopter', options='--sitl=127.0.0.1:5501 --out=127.0.0.1:19550 --quadcopter') mavproxy.expect('Received [0-9]+ parameters') # setup test parameters mavproxy.send('param set SYSID_THISMAV %u\n' % random.randint(100, 200)) mavproxy.send("param load %s/ArduCopter.parm\n" % testdir) mavproxy.expect('Loaded [0-9]+ parameters') # reboot with new parameters util.pexpect_close(mavproxy) util.pexpect_close(sil) sil = util.start_SIL('ArduCopter', height=HOME.alt) sim = pexpect.spawn(sim_cmd, logfile=sys.stdout, timeout=10) sim.delaybeforesend = 0 util.pexpect_autoclose(sim) options = '--sitl=127.0.0.1:5501 --out=127.0.0.1:19550 --quadcopter --streamrate=5' if viewerip: options += ' --out=%s:14550' % viewerip mavproxy = util.start_MAVProxy_SIL('ArduCopter', options=options) mavproxy.expect('Logging to (\S+)') logfile = mavproxy.match.group(1) print("LOGFILE %s" % logfile) buildlog = util.reltopdir("../buildlogs/ArduCopter-test.mavlog") print("buildlog=%s" % buildlog) if os.path.exists(buildlog): os.unlink(buildlog) os.link(logfile, buildlog) # the received parameters can come before or after the ready to fly message mavproxy.expect(['Received [0-9]+ parameters', 'Ready to FLY']) mavproxy.expect(['Received [0-9]+ parameters', 'Ready to FLY']) util.expect_setup_callback(mavproxy, expect_callback) expect_list_clear() expect_list_extend([sim, sil, mavproxy]) # get a mavlink connection going try: mav = mavutil.mavlink_connection('127.0.0.1:19550', robust_parsing=True) except Exception, msg: print("Failed to start mavlink connection on 127.0.0.1:19550" % msg) raise
def fly_ArduCopter(viewerip=None, map=False): """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 homeloc if TARGET != "sitl": util.build_SIL("ArduCopter", target=TARGET) sim_cmd = util.reltopdir( "Tools/autotest/pysim/sim_multicopter.py" ) + " --frame=%s --rate=400 --home=%f,%f,%u,%u" % (FRAME, HOME.lat, HOME.lng, HOME.alt, HOME.heading) sim_cmd += " --wind=6,45,.3" if viewerip: sim_cmd += " --fgout=%s:5503" % viewerip sil = util.start_SIL("ArduCopter", wipe=True) mavproxy = util.start_MAVProxy_SIL("ArduCopter", options="--sitl=127.0.0.1:5501 --out=127.0.0.1:19550 --quadcopter") mavproxy.expect("Received [0-9]+ parameters") # setup test parameters mavproxy.send("param load %s/copter_params.parm\n" % testdir) mavproxy.expect("Loaded [0-9]+ parameters") # reboot with new parameters util.pexpect_close(mavproxy) util.pexpect_close(sil) sil = util.start_SIL("ArduCopter", height=HOME.alt) sim = pexpect.spawn(sim_cmd, logfile=sys.stdout, timeout=10) sim.delaybeforesend = 0 util.pexpect_autoclose(sim) options = "--sitl=127.0.0.1:5501 --out=127.0.0.1:19550 --quadcopter --streamrate=5" if viewerip: options += " --out=%s:14550" % viewerip if map: options += " --map" mavproxy = util.start_MAVProxy_SIL("ArduCopter", options=options) mavproxy.expect("Logging to (\S+)") logfile = mavproxy.match.group(1) print("LOGFILE %s" % logfile) buildlog = util.reltopdir("../buildlogs/ArduCopter-test.tlog") print("buildlog=%s" % buildlog) copyTLog = False if os.path.exists(buildlog): os.unlink(buildlog) try: os.link(logfile, buildlog) except Exception: print( "WARN: Failed to create symlink: " + logfile + " => " + buildlog + ", Will copy tlog manually to target location" ) copyTLog = True # the received parameters can come before or after the ready to fly message mavproxy.expect(["Received [0-9]+ parameters", "Ready to FLY"]) mavproxy.expect(["Received [0-9]+ parameters", "Ready to FLY"]) util.expect_setup_callback(mavproxy, expect_callback) expect_list_clear() expect_list_extend([sim, sil, mavproxy]) # get a mavlink connection going try: mav = mavutil.mavlink_connection("127.0.0.1:19550", robust_parsing=True) except Exception, msg: print("Failed to start mavlink connection on 127.0.0.1:19550" % msg) raise
def run_step(step): '''run one step''' # remove old logs util.run_cmd('/bin/rm -f logs/*.BIN logs/LASTLOG.TXT') if step == "prerequisites": return test_prerequisites() if step == 'build.ArduPlane': return util.build_SIL('bin/arduplane', j=opts.j, debug=opts.debug) if step == 'build.APMrover2': return util.build_SIL('bin/ardurover', j=opts.j, debug=opts.debug) if step == 'build.ArduCopter': return util.build_SIL('bin/arducopter-quad', j=opts.j, debug=opts.debug) if step == 'build.AntennaTracker': return util.build_SIL('bin/antennatracker', j=opts.j, debug=opts.debug) if step == 'build.Helicopter': return util.build_SIL('bin/arducopter-heli', j=opts.j, debug=opts.debug) binary = binary_path(step, debug=opts.debug) if step == 'defaults.ArduPlane': return get_default_params('ArduPlane', binary) if step == 'defaults.ArduCopter': return get_default_params('ArduCopter', binary) if step == 'defaults.APMrover2': return get_default_params('APMrover2', binary) if step == 'fly.ArduCopter': return arducopter.fly_ArduCopter(binary, viewerip=opts.viewerip, map=opts.map, valgrind=opts.valgrind) if step == 'fly.CopterAVC': return arducopter.fly_CopterAVC(binary, viewerip=opts.viewerip, map=opts.map, valgrind=opts.valgrind) if step == 'fly.ArduPlane': return arduplane.fly_ArduPlane(binary, viewerip=opts.viewerip, map=opts.map, valgrind=opts.valgrind) if step == 'fly.QuadPlane': return quadplane.fly_QuadPlane(binary, viewerip=opts.viewerip, map=opts.map, valgrind=opts.valgrind) if step == 'drive.APMrover2': return apmrover2.drive_APMrover2(binary, viewerip=opts.viewerip, map=opts.map, valgrind=opts.valgrind) if step == 'build.All': return build_all() if step == 'build.Binaries': return build_binaries() if step == 'build.DevRelease': return build_devrelease() if step == 'build.Examples': return build_examples() if step == 'build.Parameters': return build_parameters() if step == 'convertgpx': return convert_gpx() raise RuntimeError("Unknown step %s" % step)
def run_step(step): '''run one step''' if step == "prerequesites": return test_prerequesites() if step == 'build.ArduPlane': return util.build_SIL('ArduPlane') if step == 'build.APMrover2': return util.build_SIL('APMrover2') if step == 'build.ArduCopter': return util.build_SIL('ArduCopter') if step == 'build1280.ArduCopter': return util.build_AVR('ArduCopter', board='mega') if step == 'build2560.ArduCopter': return util.build_AVR('ArduCopter', board='mega2560') if step == 'build1280.ArduPlane': return util.build_AVR('ArduPlane', board='mega') if step == 'build2560.ArduPlane': return util.build_AVR('ArduPlane', board='mega2560') if step == 'build1280.APMrover2': return util.build_AVR('APMrover2', board='mega') if step == 'build2560.APMrover2': return util.build_AVR('APMrover2', board='mega2560') if step == 'defaults.ArduPlane': return get_default_params('ArduPlane') if step == 'defaults.ArduCopter': return get_default_params('ArduCopter') if step == 'defaults.APMrover2': return get_default_params('APMrover2') if step == 'logs.ArduPlane': return dump_logs('ArduPlane') if step == 'logs.ArduCopter': return dump_logs('ArduCopter') if step == 'logs.APMrover2': return dump_logs('APMrover2') if step == 'fly.ArduCopter': return arducopter.fly_ArduCopter(viewerip=opts.viewerip, map=opts.map) if step == 'fly.ArduPlane': return arduplane.fly_ArduPlane(viewerip=opts.viewerip, map=opts.map) if step == 'drive.APMrover2': return apmrover2.drive_APMrover2(viewerip=opts.viewerip, map=opts.map) if step == 'build.All': return build_all() if step == 'build.Binaries': return build_binaries() if step == 'build.Examples': return build_examples() if step == 'build.Parameters': return build_parameters() if step == 'convertgpx': return convert_gpx() raise RuntimeError("Unknown step %s" % step)
def run_step(step): """run one step""" if step == "prerequesites": return test_prerequesites() if step == "build.ArduPlane": return util.build_SIL("ArduPlane") if step == "build.APMrover2": return util.build_SIL("APMrover2") if step == "build.ArduCopter": return util.build_SIL("ArduCopter") if step == "build2560.ArduCopter": return util.build_AVR("ArduCopter", board="mega2560") if step == "build2560.ArduPlane": return util.build_AVR("ArduPlane", board="mega2560") if step == "build2560.APMrover2": return util.build_AVR("APMrover2", board="mega2560") if step == "defaults.ArduPlane": return get_default_params("ArduPlane") if step == "defaults.ArduCopter": return get_default_params("ArduCopter") if step == "defaults.APMrover2": return get_default_params("APMrover2") if step == "logs.ArduPlane": return dump_logs("ArduPlane") if step == "logs.ArduCopter": return dump_logs("ArduCopter") if step == "logs.CopterAVC": return dump_logs("ArduCopter", "CopterAVC") if step == "logs.APMrover2": return dump_logs("APMrover2") if step == "fly.ArduCopter": return arducopter.fly_ArduCopter(viewerip=opts.viewerip, map=opts.map) if step == "fly.CopterAVC": return arducopter.fly_CopterAVC(viewerip=opts.viewerip, map=opts.map) if step == "fly.ArduPlane": return arduplane.fly_ArduPlane(viewerip=opts.viewerip, map=opts.map) if step == "drive.APMrover2": return apmrover2.drive_APMrover2(viewerip=opts.viewerip, map=opts.map) if step == "build.All": return build_all() if step == "build.Binaries": return build_binaries() if step == "build.Examples": return build_examples() if step == "build.Parameters": return build_parameters() if step == "convertgpx": return convert_gpx() raise RuntimeError("Unknown step %s" % step)