コード例 #1
0
def make_carla_settings(benchmark=None, task=None):
    """Make a CarlaSettings object with the settings we need."""

    settings = CarlaSettings()
    settings.set(SendNonPlayerAgentsInfo=True,
                 SynchronousMode=True,
                 NumberOfVehicles=30,
                 NumberOfPedestrians=50,
                 WeatherId=1)

    settings.set(DisableTwoWheeledVehicles=True)

    settings.randomize_seeds()  # IMPORTANT TO RANDOMIZE THE SEEDS EVERY TIME
    camera0 = sensor.Camera('rgb')
    camera0.set_image_size(WINDOW_WIDTH, WINDOW_HEIGHT)
    camera0.set(FOV=100)
    camera0.set_image_size(800, 600)
    camera0.set_position(2.0, 0.0, 1.4)
    camera0.set_rotation(-15.0, 0, 0)

    settings.add_sensor(camera0)

    camera0 = sensor.Camera('hudcamera')
    camera0.set_image_size(WINDOW_WIDTH, WINDOW_HEIGHT)
    camera0.set(FOV=100)
    camera0.set_image_size(1280, 730)
    camera0.set_position(-5.5, 0.0, 2.8)
    camera0.set_rotation(-15.0, 0, 0)

    settings.add_sensor(camera0)

    return settings
コード例 #2
0
    def build_experiments(self):
        """
        Creates the whole set of experiment objects,
        The experiments created depend on the selected Town.
        """

        # We set the RGB, seg cameras
        if self.rgb:
            camera = Camera('rgb')
            camera.set(FOV=100)
            camera.set_image_size(800, 600)
            camera.set_position(2.0, 0.0, 1.4)
            camera.set_rotation(-15.0, 0, 0)
        if self.seg:
            seg = Camera('seg', PostProcessing='SemanticSegmentation')
            seg.set(FOV=100)
            seg.set_image_size(800, 600)
            seg.set_position(2.0, 0.0, 1.4)
            seg.set_rotation(-15.0, 0, 0)

        poses_tasks = self._poses()
        vehicles_tasks = [20]
        pedestrians_tasks = [50]
        task_names = ['normal']

        experiments_vector = []

        for weather in self.weathers:

            for iteration in range(len(poses_tasks)):
                poses = poses_tasks[iteration]
                vehicles = vehicles_tasks[iteration]
                pedestrians = pedestrians_tasks[iteration]

                conditions = CarlaSettings()
                conditions.set(
                    SendNonPlayerAgentsInfo=True,
                    NumberOfVehicles=vehicles,
                    NumberOfPedestrians=pedestrians,
                    WeatherId=weather

                )
                conditions.set(DisableTwoWheeledVehicles=True)
                # Add all the cameras that were set for this experiments
                if self.rgb:
                    conditions.add_sensor(camera)
                if self.seg:
                    conditions.add_sensor(seg)

                experiment = Experiment()
                experiment.set(
                    Conditions=conditions,
                    Poses=poses,
                    Task=iteration,
                    TaskName=task_names[iteration],
                    Repetitions=1
                )
                experiments_vector.append(experiment)

        return experiments_vector
コード例 #3
0
    def build_experiments(self):
        """
        Creates the whole set of experiment objects,
        The experiments created depend on the selected Town.


        """

        # We set the camera
        # This single RGB camera is used on every experiment

        camera = Camera('rgb')
        camera.set(FOV=100)
        camera.set_image_size(800, 600)
        camera.set_position(2.0, 0.0, 1.4)
        camera.set_rotation(-15.0, 0, 0)

        poses_tasks = self._poses()
        vehicles_tasks = [0, 15, 70]
        pedestrians_tasks = [0, 50, 150]

        vehicles_tasks = [70]
        pedestrians_tasks = [150]

        task_names = ['empty', 'normal', 'cluttered']
        task_names = ['cuttered']

        experiments_vector = []

        for weather in self.weathers:

            for iteration in range(len(poses_tasks)):
                poses = poses_tasks[iteration]
                vehicles = vehicles_tasks[iteration]
                pedestrians = pedestrians_tasks[iteration]

                conditions = CarlaSettings()
                conditions.set(SendNonPlayerAgentsInfo=True,
                               NumberOfVehicles=vehicles,
                               NumberOfPedestrians=pedestrians,
                               WeatherId=weather)
                conditions.set(DisableTwoWheeledVehicles=True)
                # Add all the cameras that were set for this experiments

                conditions.add_sensor(camera)

                experiment = Experiment()
                experiment.set(Conditions=conditions,
                               Poses=poses,
                               Task=iteration,
                               TaskName=task_names[iteration],
                               Repetitions=1)
                experiments_vector.append(experiment)

        return experiments_vector