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