class_docstr: BridgeHelper provides methos to ease the co-simulation between sumo and carla.
class_docstr_tok: ["BridgeHelper","provides","methos","to","ease","the","co-simulation","between","sumo","and","carla","."]
docstr: Creates an appropriate vtype based on the given carla_actor.
docstr_tok: ["Creates","an","appropriate","vtype","based","on","the","given","carla_actor","."]
code: def _create_sumo_vtype(carla_actor):
      """
      Creates an appropriate vtype based on the given carla_actor.
      """
      type_id = carla_actor.type_id
      attrs = carla_actor.attributes
      extent = carla_actor.bounding_box.extent
  
      if int(attrs["number_of_wheels"]) == 2:
          traci.vehicletype.copy("DEFAULT_BIKETYPE", type_id)
      else:
          traci.vehicletype.copy("DEFAULT_VEHTYPE", type_id)
  
      if type_id in BridgeHelper._VTYPES:
          if "vClass" in BridgeHelper._VTYPES[type_id]:
              _class = BridgeHelper._VTYPES[type_id]["vClass"]
              traci.vehicletype.setVehicleClass(type_id, _class)
  
          if "guiShape" in BridgeHelper._VTYPES[type_id]:
              shape = BridgeHelper._VTYPES[type_id]["guiShape"]
              traci.vehicletype.setShapeClass(type_id, shape)
  
      if "color" in attrs:
          color = attrs["color"].split(",")
          traci.vehicletype.setColor(type_id, color)
  
      traci.vehicletype.setLength(type_id, 2.0 * extent.x)
      traci.vehicletype.setWidth(type_id, 2.0 * extent.y)
      traci.vehicletype.setHeight(type_id, 2.0 * extent.z)
  
      logging.debug(
          """[BridgeHelper] blueprint %s not found in sumo vtypes
              \tdefault vtype: %s
              \tvtype: %s
              \tclass: %s
              \tshape: %s
              \tcolor: %s
              \tlenght: %s
              \twidth: %s
              \theight: %s""",
          type_id,
          "DEFAULT_BIKETYPE"
          if int(attrs["number_of_wheels"]) == 2
          else "DEFAULT_VEHTYPE",
          type_id,
          traci.vehicletype.getVehicleClass(type_id),
          traci.vehicletype.getShapeClass(type_id),
          traci.vehicletype.getColor(type_id),
          traci.vehicletype.getLength(type_id),
          traci.vehicletype.getWidth(type_id),
          traci.vehicletype.getHeight(type_id),
      )
  
      return type_id
  
file_path: carla/Co-Simulation/Sumo/sumo_integration/bridge_helper.py
imports: import json
  import logging
  import math
  import os
  import random
  import carla
  import traci
  from .sumo_simulation import SumoSignalState, SumoVehSignal
label_desc: Use image node_id 5 for calling the BridgeHelper obj's underlying member method code with example usage: obj._create_sumo_vtype(carla_actor) and returns: type_id