forked from carla-simulator/rllib-integration
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnewHelper.py
67 lines (62 loc) · 2.56 KB
/
newHelper.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
from rllib_integration.GetStartStopLocation import spawn_points_2_lane_roundabout_small_easy, \
spawn_points_2_lane_roundabout_small_difficult, lower_medium_roundabout_easy, lower_medium_roundabout_difficult, \
upper_medium_roundabout, roundabout20m
def get_route_type(current_entry_idx, current_exit_idx):
lane = ''
found = False
ifroundabout20m = False
ifupper_medium_roundabout = False
iflower_medium_roundabout_all = False
if50Roundabout_roundabout_all = False
if16Roundabout_roundabout_all = False
for entry_easy in roundabout20m:
entry_idx = entry_easy[0]
if current_entry_idx == entry_idx:
if current_exit_idx in entry_easy[1]:
found = True
ifroundabout20m = True
lane = entry_easy[2]
break
if not found:
for entry_easy in upper_medium_roundabout:
entry_idx = entry_easy[0]
if current_entry_idx == entry_idx:
if current_exit_idx in entry_easy[1]:
found = True
ifupper_medium_roundabout = True
lane = entry_easy[2]
break
if not found:
for entry_easy in (lower_medium_roundabout_easy+lower_medium_roundabout_difficult):
entry_idx = entry_easy[0]
if current_entry_idx == entry_idx:
if current_exit_idx in entry_easy[1]:
found = True
iflower_medium_roundabout_all = True
lane = entry_easy[2]
break
if not found:
for entry_easy in (spawn_points_2_lane_roundabout_small_easy+spawn_points_2_lane_roundabout_small_difficult):
entry_idx = entry_easy[0]
if current_entry_idx == entry_idx:
if current_exit_idx in entry_easy[1]:
entryIndx50mRoundabout = [73,15,55,96,58,119,22,16,96,58]
found = True
lane = entry_easy[2]
if current_entry_idx in entryIndx50mRoundabout:
if50Roundabout_roundabout_all = True
else:
if16Roundabout_roundabout_all = True
break
if iflower_medium_roundabout_all:
return '32m',lane
elif ifupper_medium_roundabout:
return '40m',lane
elif ifroundabout20m:
return '20m',lane
elif if16Roundabout_roundabout_all:
return '16m',lane
elif if50Roundabout_roundabout_all:
return '50m',lane
else:
raise Exception('fuc')