示例#1
0
def main(argv):

    display = True
    batman = False
    try:
        opts, args = getopt.getopt(
            argv, "bhn:d", ["batman", "help", "name=", "disableDisplay"])

    except Exception as e:
        print("-n <name> -d disables LED output")
        print(e)
        sys.exit(0)

    name = None
    for opt, arg in opts:
        if opt == "-h":
            print("-n <name> -d disables LED output")
            sys.exit()
        if opt in ('-n', "--name"):
            name = arg
        if opt in ('-d', "--disableDisplay"):
            display = False
            print("LED display is disabled")
        if opt in ('-b', "--batman"):
            batman = True

    if name == None:
        print("Using hostname as UAV name!")

    kill = Killer()

    node = Client("MULTI_ROTOR", name, kill, batman, display)
    node.initVehicle()
    node.initV2V()
    node.initConn()
示例#2
0
def main():

    #store JWT into 'token'
    with open("mwalton.token", "r") as toke:
        token = toke.read()

    #Get the IP and Port of server from the localIP py file

    HOST = "192.168.254.11"
    PORT = 65432

    #These two pipes send data from the UI to the clientHandler server loop
    input_parent_conn, input_child_conn = mp.Pipe()
    output_parent_conn, output_child_conn = mp.Pipe()

    #create api interface with onesky
    utm = OneSkyAPI(token)

    kill = Killer()

    #instantiate the UI with the pipes
    ui = UI(input_child_conn, output_parent_conn, kill)
    #instantiate the server

    p_server = mp.Process(target=runServer,
                          args=(HOST, PORT, utm, input_parent_conn,
                                output_child_conn, "castle", True, True))
    p_server.daemon = True
    p_server.start()

    ui.start()
    p_server.join()
    sys.exit(0)
示例#3
0
def main(argv):

    #store JWT into 'token'
    with open("mwalton.token", "r") as toke:
        token = toke.read()

    #Get the IP and Port of server from the localIP py file

    



    subprocess.call(['../utils/./sysinfo.sh'])
    time.sleep(.00001)
    peripherals = [line.rstrip('\n') for line in open('sysdisc.txt')]   
    ethernetIP = peripherals[2]
    batmanIP = peripherals[3]
    wlan0 = peripherals[4]
    
    opts, args = getopt.getopt(argv, "ebw", ["ethernet", "batman", "wifi"])
    
    HOST = ""
    
    for opt, arg in opts:
        if opt == "-e":
            HOST = ethernetIP
        if opt == "-b":
            HOST = batmanIP
        if opt == "-w":
            HOST = wlan0
    
    if HOST == "":
        print("Please select ethernet, batman, or wifi with -e, -b, -w")
        sys.exit(0)

    PORT = 65432

    #These two pipes send data from the UI to the clientHandler server loop
    input_parent_conn, input_child_conn = mp.Pipe()
    output_parent_conn, output_child_conn = mp.Pipe()

    #create api interface with onesky
    utm = OneSkyAPI(token)

    kill = Killer()

    #instantiate the UI with the pipes
    ui = UI(input_child_conn, output_parent_conn, kill)
    #instantiate the server
    
    p_server = mp.Process(target= runServer, args=(HOST, PORT, utm, input_parent_conn, output_child_conn,  "castle", True, True))
    p_server.daemon = True
    p_server.start()

    ui.start()    
    p_server.join()    
    sys.exit(0)
示例#4
0
def main(argv):

    display = True
    batman = False
    try:
        opts, args = getopt.getopt(argv, "ewsbhfgn:dm", [
            "ethernet", "wifi", "silvus", "batman", "help", "name=",
            "disableDisplay", "measuring"
        ])

    except Exception as e:
        print("-n <name> -d disables LED output")
        print(e)
        sys.exit(0)
    name = None
    network_type = None
    location_data = "pixhawk"
    for opt, arg in opts:
        if opt == "-h":
            print("-n <name> -d disables LED output")
            sys.exit()
        if opt in ('-n', "--name"):
            name = arg
        if opt in ('-d', "--disableDisplay"):
            display = False
            print("LED display is disabled")
        if opt in ('-b', "--batman"):
            network_type = "batman"
        if opt == "-s":
            network_type = "silvus"
        if opt == "-w":
            network_type = "wifi"
        if opt == "-e":
            network_type = "ethernet"
        if opt == "-g":
            location_data = "gps"
    if network_type == None:
        print("Please enter -b, -w, -e, -s for network type")
        sys.exit(0)
    if name == None:
        print("Using hostname as UAV name!")
        name = socket.gethostname()

    kill = Killer()

    ovs = OnboardVehicleSystem("MULTI_ROTOR", name, network_type, display,
                               kill, location_data)

    if location_data == "gps":
        ovs.connect_to_gps()
    else:
        ovs.connect_to_flight_controller()

    threading.Thread(target=ovs.broadcast_telem).start()
    threading.Thread(target=ovs.vehicle_to_vehicle).start()
    ovs.recieve_gcs_message()
    ovs.gcs_listening_sock.close()
示例#5
0
def main(argv):

	'''
	param argv: user arguments
	'''
#	with open("mwalton.token", "r") as toke:
#		token = toke.read()

	#shell script for finding ips associated with all network adapters, saves to ip.txt
	subprocess.call(['../utils/find_ip.sh'])
	ips = [line.rstrip('\n') for line in open('ip.txt')] 
	ethernet_ip, batman_ip, wlan0 = ips[0], ips[1], ips[2]
	opts, args = getopt.getopt(argv, "ebwsr:", ["ethernet", "batman", "wifi", "silvus", "radioIP"])
	host = ""
	silvus_ip = None
	silv = False
	for opt, arg in opts:
		if opt == '-e': 
			host = ethernet_ip
		if opt == '-s':
			host = ethernet_ip
			silv = True
		if opt == '-b':	
			host = batman_ip
		if opt == '-w':
			host = wlan0
		if opt == '-m':
			measuring = True
		if opt == '-r':
			silvus_ip = arg
	if silv and not silvus_ip:
		print("Please include the IP address on the back of the radio when using silvus if measuring network performance")
		sys.exit(0)
	if host == "":
		print("Please select ethernet, silvus, batman, or wifi with -e, -s, -b, -w")
		sys.exit(0)
	killer = Killer()
	#create onesky api objecct
#	onesky = OneSkyAPI(token)
	onesky = ""
	gcs = GroundControl(onesky, host, silvus_ip, killer)
	gcs.run()