File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -547,22 +547,15 @@ def destroy(self) -> None:
547547 self ._cleanup ()
548548 if self .scenario_manager is not None :
549549 del self .scenario_manager
550- if self .carla_client is not None :
551- del self .carla_client
552- if self .carla_world is not None :
553- del self .carla_world
554550
555551 def _cleanup (self ) -> None :
556552 """Cleanup function. Removes instances of the CARLA client and WORLD, also destroys the Ego vehicle in CARLA."""
557-
558- if self .carla_world is not None :
559- try :
560- # Reset to asynchronous mode
561- self .carla_client .get_trafficmanager (
562- int (self ._carla .TRAFFIC_MANAGER .PORT )
563- ).set_synchronous_mode (False )
564- except RuntimeError :
565- sys .exit (- 1 )
553+ try :
554+ CarlaDataProvider .get_client ().get_trafficmanager (
555+ int (self ._carla .TRAFFIC_MANAGER .PORT )
556+ ).set_synchronous_mode (False )
557+ except RuntimeError :
558+ sys .exit (- 1 )
566559
567560 self .scenario_manager .cleanup ()
568561
You can’t perform that action at this time.
0 commit comments