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","."]
docstr: Spawns a new actor.
  
      :param type_id: vtype to be spawned.
      :param color: color attribute for this specific actor.
      :return: actor id if the actor is successfully spawned. Otherwise, INVALID_ACTOR_ID.
docstr_tok: ["Spawns","a","new","actor",".",":","param","type_id",":","vtype","to","be","spawned",".",":","param","color",":","color","attribute","for","this","specific","actor",".",":","return",":","actor","id","if","the","actor","is","successfully","spawned",".","Otherwise",",","INVALID_ACTOR_ID","."]
code: def spawn_actor(self, type_id, color=None):
      """
      Spawns a new actor.
  
          :param type_id: vtype to be spawned.
          :param color: color attribute for this specific actor.
          :return: actor id if the actor is successfully spawned. Otherwise, INVALID_ACTOR_ID.
      """
      actor_id = "carla" + str(self._sequential_id)
      try:
          vclass = traci.vehicletype.getVehicleClass(type_id)
          if vclass not in self._routes:
              logging.debug(
                  "Creating route for %s vehicle class", vclass
              )
              allowed_edges = [
                  e for e in self.net.getEdges() if e.allows(vclass)
              ]
              if allowed_edges:
                  traci.route.add(
                      "carla_route_{}".format(vclass),
                      [allowed_edges[0].getID()],
                  )
                  self._routes.add(vclass)
              else:
                  logging.error(
                      "Could not found a route for %s. No vehicle will be spawned in sumo",
                      type_id,
                  )
                  return INVALID_ACTOR_ID
  
          traci.vehicle.add(
              actor_id, "carla_route_{}".format(vclass), typeID=type_id
          )
      except traci.exceptions.TraCIException as error:
          logging.error("Spawn sumo actor failed: %s", error)
          return INVALID_ACTOR_ID
  
      if color is not None:
          color = color.split(",")
          traci.vehicle.setColor(actor_id, color)
  
      self._sequential_id += 1
  
      return actor_id
  
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 7 for calling the SumoSimulation obj's underlying member method code with example usage: obj.spawn_actor(type_id, color) and returns: actor_id, INVALID_ACTOR_ID, INVALID_ACTOR_ID