Beispiel #1
0
    parser = argparse.ArgumentParser(description=description)

    parser.add_argument('-t',
                        '--town',
                        default='Town01',
                        help='The town name to be used')

    parser.add_argument('-o',
                        '--output',
                        default='routes_test.xml',
                        help='The outputfile route')

    arguments = parser.parse_args()

    if not check_test_server(6666):
        start_test_server(6666)
        print(" WAITING FOR DOCKER TO BE STARTED")

    client = carla.Client('localhost', 6666)

    client.set_timeout(30.0)
    world = client.load_world(arguments.town)

    spawn_points = world.get_map().get_spawn_points()
    print(spawn_points)
    view_start_positions(world, spawn_points)

    selected_pos = [[10, 54], [53, 11], [48, 7], [61, 71], [74, 62], [50, 79],
                    [75, 49], [80, 53], [80, 50], [60, 80], [83, 61], [94, 72],
                    [43, 74], [13, 66], [89, 64], [15, 70], [11, 59], [15, 94],
Beispiel #2
0
    def start(self, no_server=False, agent_name=None):
        """
        :param no_server:
        :param agent_name: the name of an agent to check for previous executions.
        :return:
        """
        # TODO: this setup is hardcoded for Batch_size == 1
        # TODO add here several server starts into a for
        # TODO for i in range(self._batch_size)
        logging.debug("Starting the CEXP System !")
        if agent_name is not None and not self.ignore_previous_execution:
            Environment.check_for_executions(agent_name,
                                             self._json['package_name'])
        if no_server:
            self._client_vec = []
        else:
            if self._port is None:
                # Starting the carla simulators
                for env in self._environment_batch:
                    free_port = find_free_port()
                    env.reset(port=free_port)
            else:
                # We convert it to integers
                self._port = int(self._port)
                if not check_test_server(self._port):
                    logging.debug("No Server online starting one !")
                    self._environment_batch[0].reset(port=self._port)
                free_port = self._port  # This is just a test mode where CARLA is already up.
            # setup world and client assuming that the CARLA server is up and running
            logging.debug(" Connecting to the free port client")
            self._client_vec = [carla.Client('localhost', free_port)]
            self._client_vec[0].set_timeout(self.client_timeout)

        # Create the configuration dictionary of the exp batch to pass to all environments
        env_params = {
            'batch_size':
            self._batch_size,
            'make_videos':
            self._params['make_videos'],
            'resize_images':
            self._params['resize_images'],
            'save_dataset':
            self._params['save_dataset'],
            'save_sensors':
            self._params['save_dataset'] and self._params['save_sensors'],
            'save_opponents':
            self._params['save_opponents'],
            'package_name':
            self._json['package_name'],
            'save_walkers':
            self._params['save_walkers'],
            'save_trajectories':
            self._params['save_trajectories'],
            'remove_wrong_data':
            self._params['remove_wrong_data'],
            'non_rendering_mode':
            self._params['non_rendering_mode'],
            'carla_recording':
            self._params['carla_recording'],
            'direct_read':
            self._params['direct_read'],
            'agent_name':
            agent_name,
            'trajectories_directory':
            self._params['trajectories_directory'],
            'debug':
            False  # DEBUG SHOULD BE SET
        }

        # We instantiate environments here using the recently connected client
        self._environments = {}
        parserd_exp_dict = parser.parse_exp_vec(
            self._jsonfile_path,
            collections.OrderedDict(
                sort_nicely_dict(self._json['envs'].items())))

        # For all the environments on the file.
        for env_name in self._json['envs'].keys():
            # We have the options to eliminate some events from execution.
            if env_name in self._eliminated_environments:
                continue
            # Instance an _environments.
            env = Environment(env_name, self._client_vec,
                              parserd_exp_dict[env_name], env_params)
            # add the additional sensors ( The ones not provided by the policy )
            self._environments.update({env_name: env})
Beispiel #3
0
# TEST 3  Random adding and many problems

if __name__ == '__main__':
    # PORT 6666 is the default port for testing server

    root = logging.getLogger()
    root.setLevel(logging.DEBUG)

    handler = logging.StreamHandler(sys.stdout)
    handler.setLevel(logging.DEBUG)
    formatter = logging.Formatter(
        '%(asctime)s - %(name)s - %(levelname)s - %(message)s')
    handler.setFormatter(formatter)
    root.addHandler(handler)

    if not check_test_server(4444):
        print(" WAITING FOR DOCKER TO BE STARTED")
        start_test_server(4444)

    #if os.path.exists(os.path.join(os.environ["SRL_DATASET_PATH"], 'sample_benchmark2')):
    #    shutil.rmtree(os.path.join(os.environ["SRL_DATASET_PATH"], 'sample_benchmark2'))

    #test_distance_intersection_speed(world)
    # The idea is that the agent class should be completely independent
    #test_1_collect()
    # Auto Cleanup
    test_1_benchmark()
    # this could be joined
    # THe experience is built, the files necessary

    #test_2_benchmark()
    )

    parser = argparse.ArgumentParser(description=description)

    parser.add_argument('-t',
                        '--town',
                        default='Town01',
                        help='The town name to be used')

    parser.add_argument('-o',
                        '--output',
                        default='routes_test.xml',
                        help='The outputfile route')

    arguments = parser.parse_args()

    free_port = find_free_port()

    if not check_test_server(free_port):
        start_test_server(free_port, gpu=0, docker_name='carlaped')
        print(" WAITING FOR DOCKER TO BE STARTED")

    client = carla.Client('localhost', free_port)
    client.set_timeout(25.0)

    world = client.load_world(arguments.town)

    print('World loaded')

    make_routes(arguments.output, world)