Exemple #1
0
        uav_zmq_control_socket = create_zmq("SUB",
                                            uav_zmq_control_connection_str,
                                            ftr, True)
        if args.verbose == 2 or args.verbose == 3:
            ver = True
        else:
            ver = False
        uav_thread = threading.Thread(
            target=uav.UAV,
            args=(format(i, "03d"), (5760 + i * 10), uav_zmq_tel_socket,
                  uav_zmq_control_socket, ver))  # DIRECT
        uav_thread.setName("UAV_" + uav_id)
        uav_thread.deamon = True
        uav_thread.start()
        uav_obj.append(uav_thread)

    if args.verbose == 1 or args.verbose == 3:
        ver = True
    else:
        ver = False

    gcs.main(5501, 5500, args.instance, ver)  # NS3
    # gcs.main(5551, 5550, args.verbose)  # DIRECT

    print("[MAIN] Terminating the SITL instances")
    for p in proc_instance:
        print("[MAIN] Killing process:", p.pid)
        os.kill(p.pid, 0)
        p.kill()
        os.killpg(os.getpgid(p.pid + 1), signal.SIGTERM)
        uav_zmq_control_connection_str = "tcp://127.0.0.1:5550"  # DIRECT
        ftr = "@@@G_" + uav_id
        uav_zmq_control_socket = create_zmq("SUB", uav_zmq_control_connection_str, ftr, True)
        if args.verbose == 2 or args.verbose == 3:
            ver = True
        else:
            ver = False
        uav_thread = threading.Thread(target=uav.UAV, args=(format(i, "03d"), (5760 + i * 10),
                                                            uav_zmq_tel_socket, uav_zmq_control_socket, ver))
        uav_thread.setName("UAV_" + uav_id)
        uav_thread.deamon = True
        uav_thread.start()
        uav_obj.append(uav_thread)

    if args.verbose == 1 or args.verbose == 3:
        ver = True
    else:
        ver = False

    #gcs.main(5501, 5500, args.instance, ver)  # NS3
    gcs.main(5551, 5550, args.instance, ver)  # DIRECT

    print("[MAIN] Terminating the SITL instances")
    for p in proc_instance:
        print("[MAIN] Killing process:", p.pid)
        os.kill(p.pid, 0)
        p.kill()
        os.killpg(os.getpgid(p.pid+1), signal.SIGTERM)