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

Well, the signature for the Logic.__init__ at https://sumo.dlr.de/pydoc/traci._trafficlight.html#Logic reads:

__init__(self, programID, type, currentPhaseIndex, phases=None, subParameter=None)

Should rather lead to the following in my opinion:

logic = traci.trafficlights.Logic("new-program", 0, 0, phases=phases)


Regards

Mirko

-----Original-Nachricht-----
Betreff: [sumo-user] Cannot set trafficlights logic
Datum: 2019-02-28T14:01:30+0100
Von: "matthew_zammit" <matthewzammit.77@xxxxxxxxx>
An: "sumo-user@xxxxxxxxxxx" <sumo-user@xxxxxxxxxxx>

/def set_sig(phase0_duration, phase2_duration):
phases = []
phases.append(traci.trafficlights.Phase(phase0_duration, 0, 0, "rG"))
phases.append(traci.trafficlights.Phase(3, 0, 0, "yy"))
phases.append(traci.trafficlights.Phase(phase2_duration, 0, 0, "Gr"))
phases.append(traci.trafficlights.Phase(3, 0, 0, "yy"))
logic = traci.trafficlights.Logic("new-program", 0, 0, 0, [phases])
traci.trafficlights.setCompleteRedYellowGreenDefinition("tl1", logic)/

Calling this function gives the following error script:

/ File "rl_test.py", line 96, in set_sig
traci.trafficlights.setCompleteRedYellowGreenDefinition("tl1", logic)
File "C:\Program Files (x86)\Eclipse\Sumo\tools\traci\_trafficlight.py",
line 256, in setCompleteRedYellowGreenDefinition
for p in tls.phases:
TypeError: 'int' object is not iterable
Error: tcpip::Socket::recvAndCheck @ recv: peer shutdown
Quitting (on error)./

How do I fix this, please?



--
Sent from: http://sumo-user-mailing-list.90755.n8.nabble.com/
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/sumo-user



Back to the top