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: Returns carla vehicle light state based on sumo signals.
docstr_tok: ["Returns","carla","vehicle","light","state","based","on","sumo","signals","."]
code: def get_carla_lights_state(current_carla_lights, sumo_lights):
      """
      Returns carla vehicle light state based on sumo signals.
      """
      current_lights = current_carla_lights
  
      # Blinker right / emergency.
      if any(
          [
              bool(sumo_lights & SumoVehSignal.BLINKER_RIGHT),
              bool(sumo_lights & SumoVehSignal.BLINKER_EMERGENCY),
          ]
      ) != bool(current_lights & carla.VehicleLightState.RightBlinker):
          current_lights ^= carla.VehicleLightState.RightBlinker
  
      # Blinker left / emergency.
      if any(
          [
              bool(sumo_lights & SumoVehSignal.BLINKER_LEFT),
              bool(sumo_lights & SumoVehSignal.BLINKER_EMERGENCY),
          ]
      ) != bool(current_lights & carla.VehicleLightState.LeftBlinker):
          current_lights ^= carla.VehicleLightState.LeftBlinker
  
      # Break.
      if bool(sumo_lights & SumoVehSignal.BRAKELIGHT) != bool(
          current_lights & carla.VehicleLightState.Brake
      ):
          current_lights ^= carla.VehicleLightState.Brake
  
      # Front (low beam).
      if bool(sumo_lights & SumoVehSignal.FRONTLIGHT) != bool(
          current_lights & carla.VehicleLightState.LowBeam
      ):
          current_lights ^= carla.VehicleLightState.LowBeam
  
      # Fog.
      if bool(sumo_lights & SumoVehSignal.FOGLIGHT) != bool(
          current_lights & carla.VehicleLightState.Fog
      ):
          current_lights ^= carla.VehicleLightState.Fog
  
      # High beam.
      if bool(sumo_lights & SumoVehSignal.HIGHBEAM) != bool(
          current_lights & carla.VehicleLightState.HighBeam
      ):
          current_lights ^= carla.VehicleLightState.HighBeam
  
      # Backdrive (reverse).
      if bool(sumo_lights & SumoVehSignal.BACKDRIVE) != bool(
          current_lights & carla.VehicleLightState.Reverse
      ):
          current_lights ^= carla.VehicleLightState.Reverse
  
      # Door open left/right.
      if any(
          [
              bool(sumo_lights & SumoVehSignal.DOOR_OPEN_LEFT),
              bool(sumo_lights & SumoVehSignal.DOOR_OPEN_RIGHT),
          ]
      ) != bool(current_lights & carla.VehicleLightState.Position):
          current_lights ^= carla.VehicleLightState.Position
  
      return current_lights
  
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 7 for calling the BridgeHelper obj's underlying member method code with example usage: obj.get_carla_lights_state(current_carla_lights, sumo_lights) and returns: current_lights