class_docstr: SumoTrafficLight holds all the necessary data to define a traffic light in sumo:
  
      * connections (tlid, from_road, to_road, from_lane, to_lane, link_index).
      * phases (duration, state, min_dur, max_dur, nex, name).
      * parameters.
class_docstr_tok: ["SumoTrafficLight","holds","all","the","necessary","data","to","define","a","traffic","light","in","sumo",":","*","connections","(","tlid",",","from_road",",","to_road",",","from_lane",",","to_lane",",","link_index",")",".","*","phases","(","duration",",","state",",","min_dur",",","max_dur",",","nex",",","name",")",".","*","parameters","."]
docstr: Generates a default program for the given sumo traffic light
docstr_tok: ["Generates","a","default","program","for","the","given","sumo","traffic","light"]
code: def generate_default_program(tl):
      """
      Generates a default program for the given sumo traffic light
      """
      incoming_roads = [
          connection.from_road for connection in tl.connections
      ]
      for road in set(incoming_roads):
          phase_green = ["r"] * len(tl.connections)
          phase_yellow = ["r"] * len(tl.connections)
          phase_red = ["r"] * len(tl.connections)
  
          for connection in tl.connections:
              if connection.from_road == road:
                  phase_green[connection.link_index] = "g"
                  phase_yellow[connection.link_index] = "y"
  
          tl.add_phase(
              SumoTrafficLight.DEFAULT_DURATION_GREEN_PHASE,
              "".join(phase_green),
          )
          tl.add_phase(
              SumoTrafficLight.DEFAULT_DURATION_YELLOW_PHASE,
              "".join(phase_yellow),
          )
          tl.add_phase(
              SumoTrafficLight.DEFAULT_DURATION_RED_PHASE,
              "".join(phase_red),
          )
  
imports: import argparse
  import bisect
  import collections
  import logging
  import shutil
  import subprocess
  import tempfile
  import lxml.etree
  import glob
  import os
  import sys
  import carla
  import sumolib
label_desc: Use image node_id 3 for calling the SumoTrafficLight obj's underlying member method code with example usage: obj.generate_default_program(tl) without return types