class_docstr: BridgeHelper provides methos to ease the co-simulation between vissim and carla.
class_docstr_tok: ["BridgeHelper","provides","methos","to","ease","the","co-simulation","between","vissim","and","carla","."]
docstr: Returns an appropriate blueprint based on the received vissim actor.
docstr_tok: ["Returns","an","appropriate","blueprint","based","on","the","received","vissim","actor","."]
code: def get_carla_blueprint(vissim_actor):
      """
      Returns an appropriate blueprint based on the received vissim actor.
      """
      type_id = str(vissim_actor.type)
  
      if type_id in BridgeHelper.vtypes:
          candidates = BridgeHelper.vtypes[type_id]
          if candidates:
              blueprint_id = random.choice(candidates)
          else:
              logging.error(
                  "vissim type %s not supported. No vehicle will be spawned in carla",
                  type_id,
              )
              return None
  
          blueprint = BridgeHelper.blueprint_library.filter(
              blueprint_id
          )
          if not blueprint:
              logging.error(
                  "carla blueprint %s unknown. No vehicle will be spawned",
                  blueprint_id,
              )
              return None
          blueprint = blueprint[0]
  
          if blueprint.has_attribute("color"):
              color = random.choice(
                  blueprint.get_attribute("color").recommended_values
              )
              blueprint.set_attribute("color", color)
  
          if blueprint.has_attribute("driver_id"):
              driver_id = random.choice(
                  blueprint.get_attribute(
                      "driver_id"
                  ).recommended_values
              )
              blueprint.set_attribute("driver_id", driver_id)
  
          blueprint.set_attribute("role_name", "vissim_driver")
          return blueprint
  
      else:
          logging.error(
              "vissim type %s unknown. No vehicle will be spawned in carla",
              type_id,
          )
          return None
  
file_path: carla/Co-Simulation/PTV-Vissim/vissim_integration/bridge_helper.py
imports: import logging
  import math
  import random
  import carla
label_desc: Use image node_id 7 for calling the BridgeHelper obj's underlying member method code with example usage: obj.get_carla_blueprint(vissim_actor) and returns: blueprint, None, None, None