-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscenes_97.py
248 lines (184 loc) · 6.82 KB
/
scenes_97.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
from enum import Enum
branch_list = [-1, 0, 1]
# direction of car when it starts
Direction = Enum('Direction', ('North', 'East', 'South', 'West'))
#############################
# Scene Configuration
############################
class scene:
def __init__(self, ped_center, ped_range, area, NumOfWal, NumOfVeh, poses, ends, direction, lane_type, town,
scene_id):
self.ped_center = ped_center
self.ped_range = ped_range
self.area = area # minX maxX minY maxY
self.NumOfWal = NumOfWal
self.NumOfVeh = NumOfVeh
self.poses = poses
self.ends = ends
self.direction = direction
task_types = {Direction.North: [-1, 1, 0, 2], Direction.South: [1, -1, 2, 0],
Direction.West: [0, 2, 1, -1], Direction.East: [2, 0, -1, 1]}
self.task_type = [task_types[i] for i in self.direction]
self.lane_type = lane_type
self.town = town
self.scene_id = scene_id
def poses_num(self):
return len(self.poses)
def branches(self, pose):
assert pose in set(range(self.poses_num()))
branches = []
for b, v in zip(branch_list, self.lane_type[pose]):
if v == 1:
branches.append(b)
return branches
# def get_trace_id(self, pose, branch):
# trace = 0
# for i in range(pose+1):
# for j in range(len(branch_list)):
# if (self.lane_type[i][j] == 1) & (i < pose | j < branch_list.index(branch)):
# trace = trace + 1
# return trace
def scene_config(self, pose, branch):
assert pose in set(range(self.poses_num()))
assert branch in self.branches(pose), "not consistent with lane type"
# trace = self.get_trace_id(pose, branch)
scene = {
'ped_center': self.ped_center,
'ped_range': self.ped_range,
'area': self.area,
'Wait_ticks': 50,
'weather': 'ClearNoon',
'NumOfWal': self.NumOfWal,
'NumOfVeh': self.NumOfVeh,
'start': self.poses[pose],
'end': self.ends[pose][branch_list.index(branch)],
'task_type': self.task_type[pose],
'lane_type': self.lane_type[pose],
'branch': branch,
'pose': pose,
'town': self.town,
'scene_id': self.scene_id,
# 'trace': trace,
}
return scene
class scene0(scene):
def __init__(self):
super().__init__(
ped_center=741,
ped_range=30.0,
area=[-102.0, -60.0, 115.0, 152.0],
NumOfWal=[20, 30],
NumOfVeh=[0, 0],
poses=[1760, 1917, 1883],
ends=[[-1, 1844, 1367], [2327, 2001, -1], [-1, 544, 2327]],
direction=[Direction.North, Direction.North, Direction.South],
lane_type=[[0, 1, 1], [1, 1, 0], [0, 1, 1]],
town='Town03',
scene_id=0,
)
class scene1(scene):
def __init__(self):
super().__init__(
ped_center=610,
ped_range=30.0,
area=[-27.0, 25.0, 111.0, 153.0],
NumOfWal=[20, 30],
NumOfVeh=[0, 0],
poses=[1219, 593, 2015],
ends=[[-1, 2719, 1234], [1997, 79, -1], [1234, 52, -1]],
direction=[Direction.North, Direction.North, Direction.South],
lane_type=[[0, 1, 1], [1, 1, 0], [1, 1, 0]],
town='Town03',
scene_id=1,
)
class scene2(scene):
def __init__(self):
super().__init__(
ped_center=1374,
ped_range=30.0,
area=[-18.0, 25.0, -155.0, -117.0],
NumOfWal=[20, 30],
NumOfVeh=[0, 0],
poses=[2737, 1927, 1725, 2204],
ends=[[-1, 801, 353], [95, 1307, -1], [353, 346, -1], [-1, 847, 95]],
direction=[Direction.North, Direction.North, Direction.South, Direction.South],
lane_type=[[0, 1, 1], [1, 1, 0], [1, 1, 0], [0, 1, 1]],
town='Town03',
scene_id=2,
)
class scene3(scene):
def __init__(self):
super().__init__(
ped_center=2200,
ped_range=30.0,
area=[-102, -57, -160, -110],
NumOfWal=[20, 30],
NumOfVeh=[0, 0],
poses=[368, 1323, 933],
ends=[[-1, 806, 417], [2335, 2463, -1], [417, 1637, -1]],
direction=[Direction.North, Direction.North, Direction.South],
lane_type=[[0, 1, 1], [1, 1, 0], [0, 1, 0]],
town='Town03',
scene_id=3,
)
class scene4(scene):
def __init__(self):
super().__init__(
ped_center=361,
ped_range=30.0,
area=[10, 45, -35, 35],
NumOfWal=[20, 30],
NumOfVeh=[0, 0],
poses=[3762, 3758, 3664, 3660],
ends=[[-1, 3632, 555], [2288, 3622, -1], [544, 3736, -1], [-1, 3747, 297]],
direction=[Direction.North, Direction.North, Direction.South, Direction.South],
lane_type=[[0, 1, 1], [1, 1, 0], [1, 1, 0], [0, 1, 1]],
town='Town05',
scene_id=4,
)
class scene5(scene):
def __init__(self):
super().__init__(
ped_center=305,
ped_range=30.0,
area=[-70, -20, -30, 30],
NumOfWal=[20, 30],
NumOfVeh=[0, 0],
poses=[4559, 4554, 4533, 4530],
ends=[[-1, 4692, 2310], [2234, 4681, -1], [2299, 4415, -1], [-1, 4406, 2223]],
direction=[Direction.North, Direction.North, Direction.South, Direction.South],
lane_type=[[0, 1, 1], [1, 1, 0], [1, 1, 0], [0, 1, 1]],
town='Town05',
scene_id=5,
)
class scene6(scene):
def __init__(self):
super().__init__(
ped_center=413,
ped_range=30.0,
area=[61, 111, -100, -50],
NumOfWal=[0, 0],
NumOfVeh=[0, 0],
poses=[1705, 2551, 2227, 530],
ends=[[-1, 1513, -1], [2226, -1, -1], [-1, -1, 1513], [-1, 2226, -1]],
direction=[Direction.North, Direction.West, Direction.West, Direction.South],
# lane_type=[[0, 1, 0], [1, 0, 0], [0, 0, 1], [0, 1, 0]],
lane_type=[[0, 0, 0], [1, 0, 0], [0, 0, 1], [0, 0, 0]],
town='Town03',
scene_id=6,
)
class scene7(scene):
def __init__(self):
super().__init__(
ped_center=1297,
ped_range=30.0,
area=[145, 195, 40, 90],
NumOfWal=[0, 0],
NumOfVeh=[0, 0],
poses=[65],
ends=[[900, -1, 1428], ],
direction=[Direction.North, ],
lane_type=[[1, 0, 1], ],
town='Town03',
scene_id=7,
)