Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Cannot set trafficlights logic

Thanks, that was it. For anyone who has the same problem:

Q: How to permanently change phase duration with Traci/sumo?
A: This code should help you figure it out:

/def set_durations(phase0_duration, phase2_duration):
  phases = []
  phases.append(traci.trafficlights.Phase(phase0_duration,"rG", 0, 0))
#(durationtochangeto,state,min,max)
  phases.append(traci.trafficlights.Phase(3, "yy", 0, 0))
  phases.append(traci.trafficlights.Phase(phase2_duration,"Gr", 0, 0))
  phases.append(traci.trafficlights.Phase(3, "yy", 0, 0))
  logic = traci.trafficlights.Logic("0", 0, 0,
phases=phases)#(program_ID,typeofTLprog(0),always0,phases)
  traci.trafficlights.setCompleteRedYellowGreenDefinition("tl1", logic)/

Look for the parameter positions in _trafficlight.py because they may be
different depending on the Sumo version you have.



--
Sent from: http://sumo-user-mailing-list.90755.n8.nabble.com/


Back to the top