import requests import telnet argparser = argparse.ArgumentParser(description='aura link') argparser.add_argument('--hertz', default=10, type=int, help='specify main loop rate') argparser.add_argument('--serial', required=True, help='input serial port') argparser.add_argument('--baud', default=115200, type=int, help='serial port baud rate') argparser.add_argument('--telnet-port', default=5050, help='telnet port') argparser.add_argument('--http-port', default=8888, help='http/ws port') argparser.add_argument('--html-root', default='.') args = argparser.parse_args() dt = 1.0 / float(args.hertz) telnet.init(args.telnet_port) httpserver.init(args.http_port, args.html_root) try: ser = serial.Serial(args.serial, args.baud, timeout=dt) auraparser.init() except: print "Cannot open:", args.serial import serial.tools.list_ports ports = list(serial.tools.list_ports.comports()) print "Available ports:" for p in ports: print p quit() while True:
import httpserver import telnet argparser = argparse.ArgumentParser(description='aura link') argparser.add_argument('--hertz', default=10, type=int, help='specify main loop rate') argparser.add_argument('--serial', help='input serial port') argparser.add_argument('--baud', default=115200, type=int, help='serial port baud rate') argparser.add_argument('--telnet-port', default=5050, help='telnet port') argparser.add_argument('--http-port', default=8888, help='http/ws port') argparser.add_argument('--html-root', default='.') args = argparser.parse_args() dt = 1.0 / float(args.hertz) telnet.init(args.telnet_port) httpserver.init(args.http_port, args.html_root) def new_logfile(): d = datetime.datetime.utcnow() logfile = 'flight-' + d.strftime("%Y-%m-%d-%H:%M:%S") + '.log' try: f = open(logfile, 'wb') except: print "Cannot open:", logfile quit() return f if args.serial: try: ser = serial.Serial(args.serial, args.baud, timeout=dt)
def subject(edgeStr): return re.search('\(\S+ (\S+) .+\)', edgeStr).group(1) def pairwiseAssert(): # For each keypair for key in keys: # We don't actually need to assert for 'key' - we can use a test node to clear all edges print(key + ":") trueVals = (trueMap[key] if key in trueMap else []) falseVals = (falseMap[key] if key in falseMap else []) pairwiseEval(trueVals, falseVals, key) telnet.init(2426, True) telnet.command('removenode TestNode T') testnode = telnet.command('addnode TestNode ("DisjointTest")').split('|')[0] # Logging initialisation logging.basicConfig(format='%(levelname)s:%(message)s',filename='disjoint.log',level=logging.DEBUG) with open('disjoint.log', 'w'): pass # Get the files open, and assert each true edge (should stay) and false edge (should not stay) disjoints = open(sys.argv[1], 'r') trueFile = open(sys.argv[2], 'r') falseFile = open(sys.argv[3], 'r') print("Files read in") # Organise each assertion into groups by subject