-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnocrash_new_weather_town_suite.py
137 lines (97 loc) · 4.16 KB
/
nocrash_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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# 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 carla08.driving_benchmark.experiment import Experiment
from carla08.sensor import Camera
from carla08.settings import CarlaSettings
from carla08.driving_benchmark.experiment_suites.experiment_suite import ExperimentSuite
class NocrashNewWeatherTown(ExperimentSuite):
def __init__(self):
super(NocrashNewWeatherTown, self).__init__('Town02')
@property
def train_weathers(self):
return []
@property
def test_weathers(self):
return [10, 14]
@property
def collision_as_failure(self):
return True
def calculate_time_out(self, path_distance):
"""
Function to return the timeout ,in milliseconds,
that is calculated based on distance to goal.
This is the same timeout as used on the CoRL paper.
"""
return ((path_distance / 1000.0) / 5.0) * 3600.0 + 20.0
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], [34, 77], [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_central_rgb = Camera('rgb')
camera_central_rgb.set(FOV=100)
camera_central_rgb.set_image_size(800, 600)
camera_central_rgb.set_position(2.0, 0.0, 1.4)
camera_central_rgb.set_rotation(-15.0, 0, 0)
camera_central_seg = Camera('seg', PostProcessing='SemanticSegmentation')
camera_central_seg.set_image_size(800, 600)
camera_central_seg.set(FOV=100)
camera_central_seg.set_position(2.0, 0.0, 1.4)
camera_central_seg.set_rotation(-15.0, 0, 0)
camera_top_rgb = Camera('rgb')
camera_top_rgb.set_image_size(800, 600)
camera_top_rgb.set(FOV=100)
camera_top_rgb.set_position(12.0, 0.0, 15.0)
camera_top_rgb.set_rotation(-90.0, 90.0, -90.0)
camera_top_seg = Camera('seg', PostProcessing='SemanticSegmentation')
camera_top_seg.set_image_size(800, 600)
camera_top_seg.set(FOV=100)
camera_top_seg.set_position(12.0, 0.0, 15.0)
camera_top_seg.set_rotation(-90.0, 90.0, -90.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_central_rgb)
experiment = Experiment()
experiment.set(
Conditions=conditions,
Poses=poses,
Task=iteration,
TaskName=task_names[iteration],
Repetitions=1
)
experiments_vector.append(experiment)
return experiments_vector