@@ -268,19 +268,20 @@ def run_scenario(
268268 logger .info ("Calculating driving score..." )
269269 driving_score = self ._calculate_driving_score (criteria )
270270
271+ result_dict = result_ .get ()
272+ result_dict ["status" ] = result
273+ result_dict ["driving_score" ] = driving_score
274+
271275 # read the scenario definition
272- if not self .DEV_MODE :
276+ if self ._scenario_config [ "algorithm" ][ "enabled" ] :
273277 self .algorithm ._update_generator (seed )
274278
275279 definition = self .algorithm ._scenario_callback (
276280 self .json_definition , driving_score
277281 )
282+ result_dict ["definition" ] = definition
278283
279284 # update multipprocessing queue
280- result_dict = result_ .get ()
281- result_dict ["status" ] = result
282- result_dict ["definition" ] = definition
283- result_dict ["driving_score" ] = driving_score
284285 result_ .put (result_dict )
285286
286287 def run (self ) -> None :
@@ -315,6 +316,9 @@ def run(self) -> None:
315316
316317 self ._rng = np .random .default_rng (self ._scenario_config ["algorithm" ]["seed" ])
317318
319+ if not self ._scenario_config ["algorithm" ]["enabled" ]:
320+ self .iterations = 1
321+
318322 for iteration in range (self .iterations ):
319323 logger .info ("Starting CARLA container...." )
320324 CARLAManager .restart_carla ()
@@ -378,8 +382,10 @@ def run(self) -> None:
378382 self .results_manager .cleanup_xml ()
379383
380384 status = result ["status" ]
381- driving_score = result ["driving_score" ]
382- self .json_definition = result ["definition" ]
385+ driving_score = result ["driving_score" ] #
386+
387+ if self ._scenario_config ["algorithm" ]["enabled" ]:
388+ self .json_definition = result ["definition" ]
383389
384390 logger .info (
385391 f"Scenario iteration { iteration } achieved a score of { driving_score } "
0 commit comments