@@ -183,15 +183,15 @@ def __init__(self, args):
183
183
184
184
if phase_codename == 'dev' :
185
185
split_name = 'dev_split'
186
- self .routes = '{}/srunner/challenge/routes_devtest.xml' .format (scenario_runner_root )
186
+ self .routes = '{}/srunner/challenge/routes_devtest.xml' .format (scenario_runner_root )
187
187
repetitions = 1
188
188
elif phase_codename == 'validation' :
189
189
split_name = 'val_split'
190
- self .routes = '{}/srunner/challenge/routes_testprep.xml' .format (scenario_runner_root )
190
+ self .routes = '{}/srunner/challenge/routes_testprep.xml' .format (scenario_runner_root )
191
191
repetitions = 3
192
192
elif phase_codename == 'test' :
193
193
split_name = 'test_split'
194
- self .routes = '{}/srunner/challenge/routes_testchallenge.xml' .format (scenario_runner_root )
194
+ self .routes = '{}/srunner/challenge/routes_testchallenge.xml' .format (scenario_runner_root )
195
195
repetitions = 3
196
196
else :
197
197
# debug mode
@@ -252,7 +252,6 @@ def __init__(self, args):
252
252
# debugging parameters
253
253
self .route_visible = self .debug > 0
254
254
255
-
256
255
def within_available_time (self ):
257
256
current_time = datetime .datetime .now ()
258
257
elapsed_seconds = (current_time - self .start_wall_time ).seconds
@@ -281,7 +280,6 @@ def cleanup(self, ego=False):
281
280
CarlaActorPool .cleanup ()
282
281
CarlaDataProvider .cleanup ()
283
282
284
-
285
283
if ego and self .ego_vehicle is not None :
286
284
self .ego_vehicle .destroy ()
287
285
self .ego_vehicle = None
@@ -342,7 +340,7 @@ def draw_waypoints(self, waypoints, turn_positions_and_labels, vertical_shift, p
342
340
343
341
for position in range (start , end ):
344
342
self .world .debug .draw_point (waypoints [position ][0 ].location + carla .Location (z = vertical_shift ),
345
- size = 0.2 , color = color , life_time = persistency )
343
+ size = 0.2 , color = color , life_time = persistency )
346
344
347
345
self .world .debug .draw_point (waypoints [0 ][0 ].location + carla .Location (z = vertical_shift ), size = 0.2 ,
348
346
color = carla .Color (0 , 0 , 255 ), life_time = persistency )
@@ -496,7 +494,7 @@ def build_master_scenario(self, route, town_name, timeout=300):
496
494
blackboard .set ('master_scenario_command' , 'scenarios_running' )
497
495
498
496
return MasterScenario (self .world , self .ego_vehicle , master_scenario_configuration ,
499
- timeout = timeout , debug_mode = self .debug > 1 )
497
+ timeout = timeout , debug_mode = self .debug > 1 )
500
498
501
499
def build_background_scenario (self , town_name , timeout = 300 ):
502
500
scenario_configuration = ScenarioConfiguration ()
@@ -527,15 +525,15 @@ def build_background_scenario(self, town_name, timeout=300):
527
525
scenario_configuration .other_actors = [actor_configuration_instance ]
528
526
529
527
return BackgroundActivity (self .world , self .ego_vehicle , scenario_configuration ,
530
- timeout = timeout , debug_mode = self .debug > 1 )
528
+ timeout = timeout , debug_mode = self .debug > 1 )
531
529
532
530
def build_trafficlight_scenario (self , town_name , timeout = 300 ):
533
531
scenario_configuration = ScenarioConfiguration ()
534
532
scenario_configuration .route = None
535
533
scenario_configuration .town = town_name
536
534
537
535
return TrafficLightScenario (self .world , self .ego_vehicle , scenario_configuration ,
538
- timeout = timeout , debug_mode = self .debug > 1 )
536
+ timeout = timeout , debug_mode = self .debug > 1 )
539
537
540
538
def build_scenario_instances (self , scenario_definition_vec , town_name , timeout = 300 ):
541
539
"""
@@ -644,7 +642,6 @@ def run_route(self, trajectory, no_master=False):
644
642
draw_shadow = False , color = carla .Color (255 , 255 , 255 ),
645
643
life_time = 0.01 )
646
644
647
-
648
645
if self .route_visible :
649
646
turn_positions_and_labels = clean_route (trajectory )
650
647
self .draw_waypoints (trajectory , turn_positions_and_labels ,
@@ -661,15 +658,14 @@ def run_route(self, trajectory, no_master=False):
661
658
except Exception :
662
659
attempts += 1
663
660
print ('======[WARNING] The server is frozen [{}/{} attempts]!!' .format (attempts ,
664
- self .MAX_CONNECTION_ATTEMPTS ))
661
+ self .MAX_CONNECTION_ATTEMPTS ))
665
662
time .sleep (2.0 )
666
663
continue
667
664
668
-
669
665
# check for scenario termination
670
666
for i , _ in enumerate (self .list_scenarios ):
671
667
672
- if self .debug == 1 :
668
+ if self .debug == 1 :
673
669
behavior = self .list_scenarios [i ].scenario .scenario_tree .children [0 ]
674
670
if behavior .tip ():
675
671
print ("{} {} {} {}" .format (self .list_scenarios [i ].scenario .scenario_tree .name ,
@@ -680,8 +676,8 @@ def run_route(self, trajectory, no_master=False):
680
676
"InTriggerDistanceToLocationAlongRoute" and self .list_scenarios [
681
677
i ].scenario .scenario_tree .name != "MasterScenario" and
682
678
self .list_scenarios [i ].scenario .scenario_tree .name != "BackgroundActivity" and
683
- self .list_scenarios [i ].scenario .scenario_tree .name != "TrafficLightScenario" ):
684
- pass # TODO: find a fix for this ascii bug
679
+ self .list_scenarios [i ].scenario .scenario_tree .name != "TrafficLightScenario" ):
680
+ pass # TODO: find a fix for this ascii bug
685
681
# py_trees.display.print_ascii_tree(self.list_scenarios[i].scenario.scenario_tree, 2, True)
686
682
687
683
# The scenario status can be: INVALID, RUNNING, SUCCESS, FAILURE. Only the last two
@@ -694,7 +690,6 @@ def run_route(self, trajectory, no_master=False):
694
690
self .list_scenarios [i ] = None
695
691
self .list_scenarios [:] = [scenario for scenario in self .list_scenarios if scenario ]
696
692
697
-
698
693
# Route finished set for the background scenario to also finish
699
694
blackboard = py_trees .blackboard .Blackboard ()
700
695
blackboard .set ('master_scenario_command' , 'scenarios_stop_request' )
@@ -714,7 +709,6 @@ def record_fatal_error(self, error_message):
714
709
return_message = error_message
715
710
return_message += "\n =================================="
716
711
717
-
718
712
current_statistics = {'id' : - 1 ,
719
713
'score_composed' : score_composed ,
720
714
'score_route' : score_route ,
@@ -833,7 +827,6 @@ def compute_current_statistics(self):
833
827
834
828
return score_composed , score_route , score_penalty
835
829
836
-
837
830
def record_route_statistics_default (self , route_id ):
838
831
"""
839
832
This function is intended to be called from outside and provide
@@ -928,9 +921,9 @@ def record_route_statistics_default(self, route_id):
928
921
929
922
return_message += "\n =================================="
930
923
return_message += "\n ==[r{}:{}] [Score = {:.2f} : (route_score={}, infractions=-{})]" .format (route_id , result ,
931
- score_composed ,
932
- score_route ,
933
- score_penalty )
924
+ score_composed ,
925
+ score_route ,
926
+ score_penalty )
934
927
if list_collisions :
935
928
return_message += "\n ===== Collisions:"
936
929
for item in list_collisions :
@@ -985,7 +978,6 @@ def report_challenge_statistics(self, filename, show_to_participant):
985
978
for stats in self .statistics_routes :
986
979
help_message += "{}\n \n " .format (stats ['help_text' ])
987
980
988
-
989
981
else :
990
982
submission_status = 'FINISHED'
991
983
@@ -1001,7 +993,7 @@ def report_challenge_statistics(self, filename, show_to_participant):
1001
993
# create json structure
1002
994
json_data = {
1003
995
'submission_status' : submission_status ,
1004
- 'stderr' : help_message if self .phase == 'dev' or self .phase == 'debug' else 'No metadata provided for '
996
+ 'stderr' : help_message if self .phase == 'dev' or self .phase == 'debug' else 'No metadata provided for '
1005
997
'this phase' ,
1006
998
'result' : [
1007
999
{
@@ -1157,9 +1149,9 @@ def load_environment_and_run(self, args, world_annotations, route_description):
1157
1149
1158
1150
self .background_scenario = self .build_background_scenario (_route_description ['town_name' ],
1159
1151
timeout = route_timeout )
1160
-
1152
+
1161
1153
self .traffic_light_scenario = self .build_trafficlight_scenario (_route_description ['town_name' ],
1162
- timeout = route_timeout )
1154
+ timeout = route_timeout )
1163
1155
1164
1156
self .list_scenarios = [self .master_scenario , self .background_scenario , self .traffic_light_scenario ]
1165
1157
# build the instance based on the parsed definitions.
@@ -1332,7 +1324,6 @@ def run(self, args):
1332
1324
print ("Error. ROOT_SCENARIO_RUNNER not found. Please run setup_environment.sh first." )
1333
1325
sys .exit (0 )
1334
1326
1335
-
1336
1327
if ARGUMENTS .scenarios is None :
1337
1328
print ("Please specify a path to a scenario specification file '--scenarios path-to-file'\n \n " )
1338
1329
PARSER .print_help (sys .stdout )
0 commit comments