class_docstr: SumoSimulation is responsible for the management of the sumo simulation.
class_docstr_tok: ["SumoSimulation","is","responsible","for","the","management","of","the","sumo","simulation","."]
code: def __init__(
      self,
      cfg_file,
      step_length,
      host=None,
      port=None,
      sumo_gui=False,
      client_order=1,
  ):
      if sumo_gui is True:
          sumo_binary = sumolib.checkBinary("sumo-gui")
      else:
          sumo_binary = sumolib.checkBinary("sumo")
  
      if host is None or port is None:
          logging.info("Starting new sumo server...")
          if sumo_gui is True:
              logging.info(
                  "Remember to press the play button to start the simulation"
              )
  
          traci.start(
              [
                  sumo_binary,
                  "--configuration-file",
                  cfg_file,
                  "--step-length",
                  str(step_length),
                  "--lateral-resolution",
                  "0.25",
                  "--collision.check-junctions",
              ]
          )
  
      else:
          logging.info(
              "Connection to sumo server. Host: %s Port: %s", host, port
          )
          traci.init(host=host, port=port)
  
      traci.setOrder(client_order)
  
      # Retrieving net from configuration file.
      self.net = _get_sumo_net(cfg_file)
  
      # To keep track of the vehicle classes for which a route has been generated in sumo.
      self._routes = set()
  
      # Variable to asign an id to new added actors.
      self._sequential_id = 0
  
      # Structures to keep track of the spawned and destroyed vehicles at each time step.
      self.spawned_actors = set()
      self.destroyed_actors = set()
  
      # Traffic light manager.
      self.traffic_light_manager = SumoTLManager()
  
imports: import collections
  import enum
  import logging
  import os
  import carla
  import sumolib
  import traci
  from .constants import INVALID_ACTOR_ID
  import lxml.etree
label_desc: Use image node_id 1 to create a new SumoSimulation object from inherited base classes: object with example: obj = SumoSimulation(cfg_file, step_length, host, port, sumo_gui, client_order)