Ejemplo n.º 1
0
def go(filename,
       address,
       constant_throttle=0,
       num_cars=1,
       image_cb=None,
       rand_seed=None):

    print("loading model", filename)
    model = load_model(filename)

    # In this mode, looks like we have to compile it
    model.compile("sgd", "mse")

    clients = []

    for _ in range(0, num_cars):
        # setup the clients
        handler = DonkeySimMsgHandler(model,
                                      constant_throttle,
                                      image_cb=image_cb,
                                      rand_seed=rand_seed)
        client = SimClient(address, handler)
        clients.append(client)

    while clients_connected(clients):
        try:
            time.sleep(0.02)
            for client in clients:
                client.msg_handler.update()
        except KeyboardInterrupt:
            # unless some hits Ctrl+C and then we get this interrupt
            print('stopping')
            break
Ejemplo n.º 2
0
    def __init__(self, conf):
        logger.setLevel(conf["log_level"])

        self.address = (conf["host"], conf["port"])

        self.handler = DonkeyUnitySimHandler(conf=conf)

        self.client = SimClient(self.address, self.handler)
Ejemplo n.º 3
0
    def __init__(self,
                 level,
                 host='127.0.0.1',
                 port=9090,
                 max_cte=1.0,
                 loglevel='INFO',
                 cam_resolution=(120, 160, 3)):

        logger.setLevel(loglevel)

        self.address = (host, port)

        self.handler = DonkeyUnitySimHandler(level,
                                             max_cte=max_cte,
                                             cam_resolution=cam_resolution)

        self.client = SimClient(self.address, self.handler)
Ejemplo n.º 4
0
def go(filename, address, constant_throttle, gif):
    model = load_model(filename, compile=False)

    # In this mode, looks like we have to compile it
    model.compile("sgd", "mse")

    movie_handler = None

    if gif != "none":
        movie_handler = GifCreator(gif)

    # setup the server
    handler = DonkeySimMsgHandler(model, constant_throttle, movie_handler)
    client = SimClient(address, handler)

    while client.is_connected():
        try:
            time.sleep(1.0)
        except KeyboardInterrupt:
            # unless some hits Ctrl+C and then we get this interrupt
            print("stopping")
            break