-
Notifications
You must be signed in to change notification settings - Fork 68
/
long_new_weather_town_suite.py
111 lines (75 loc) · 3.01 KB
/
long_new_weather_town_suite.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
# CORL experiment set.
from __future__ import print_function
from carla.driving_benchmark.experiment import Experiment
from carla.sensor import Camera
from carla.settings import CarlaSettings
from carla.driving_benchmark.experiment_suites.experiment_suite import ExperimentSuite
class LongNewWeatherTown(ExperimentSuite):
def __init__(self):
super(LongNewWeatherTown, self).__init__('Town02')
@property
def train_weathers(self):
return []
@property
def test_weathers(self):
return [4, 14]
@property
def collision_as_failure(self):
return True
def _poses(self):
def _poses_navigation():
return [[19, 66], [79, 14], [19, 57], [39, 53], [60, 26],
[53, 76], [42, 13], [31, 71], [59, 35], [47, 16],
[10, 61], [66, 3], [20, 79], [14, 56], [26, 69],
[79, 19], [2, 29], [16, 14], [5, 57], [77, 68],
[70, 73], [46, 67], [57, 50], [61, 49], [21, 12]]
return [_poses_navigation(),
_poses_navigation(),
_poses_navigation()]
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]
task_names = ['empty', 'normal', 'cluttered']
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