So, I have the following code. However, because sometimes the light color is
changed too abruptly vehicles will have to emergency stop and occasionally
there will be teleporting. What would you recommend as the best way to
gracefully prefer a certain lane?
for id in trafficLightIDs:
lanes = list(set(traci.trafficlights.getControlledLanes(id)))
fuelConsumption = []
for lane in lanes:
fuelConsumption.append(traci.lane.getFuelConsumption(lane))
print(traci.lane.getLength(lane))
if not all(v == 0 for v in fuelConsumption):
print("here")
max_val = max(fuelConsumption)
index_max = fuelConsumption.index(max_val)
if index_max == 0 or index_max == 2:
if traci.trafficlights.getPhase(id) != 0:
traci.trafficlights.setPhase(id,0)
else:
if traci.trafficlights.getPhase(id) != 2:
traci.trafficlights.setPhase(id,2)
Sean Oesch
Security Researcher & Software Architect
CISR Group at Oak Ridge National Laboratory
Leader Blockchain Initiative
________________________________
From: [email protected] <[email protected]> on behalf of
Oesch, T. Sean <[email protected]>
Sent: Tuesday, October 16, 2018 9:17 AM
To: Jakob Erdmann
Cc: sumo developer discussions
Subject: [UNTRUSTED] Re: [sumo-dev] Most efficient way to iterate all traffic
lights and view vehicle types incoming?
So, let's say I have the following values for fuel consumption in each lane.
How would I set the traffic light to allow lane B0A0_0 to go? I am unsure about
the correlation between the lane values and the traffic signal.
'A1A0_0': 0.0, 'B0A0_0': 2624.722222222222, 'bottom0A0_0': 0.0, 'left0A0_0':
0.0?
Thanks!
Sean Oesch
Security Researcher & Software Architect
CISR Group at Oak Ridge National Laboratory
Leader Blockchain Initiative
________________________________
From: Jakob Erdmann <[email protected]>
Sent: Monday, October 15, 2018 10:30 AM
To: Oesch, T. Sean
Cc: sumo developer discussions
Subject: Re: [sumo-dev] Most efficient way to iterate all traffic lights and
view vehicle types incoming?
If your switching algorithm does not care about the direction from which the
vehicles are coming, then yes.
Am Mo., 15. Okt. 2018 um 15:21 Uhr schrieb Oesch, T. Sean
<[email protected]<mailto:[email protected]>>:
What I would like to do is change the phase of the light based on the type of
vehicles in each lane. Could I do something like the following pseudocode? Or
would I need to use getControlledLinks to do this fluidly?
lanes = trafficlight.getControlledLanes(id)
for incomingLane in lanes:
carTypes[incomingLane] = incomingLane.getVehicles.getTypeList()
setLightPhase(carTypes)?
Sean Oesch
Security Researcher & Software Architect
CISR Group at Oak Ridge National Laboratory
Leader Blockchain Initiative
________________________________
From: Jakob Erdmann <[email protected]<mailto:[email protected]>>
Sent: Monday, October 15, 2018 2:36 AM
To: Oesch, T. Sean; sumo developer discussions
Subject: re: [sumo-dev] Most efficient way to iterate all traffic lights and
view vehicle types incoming?
Every traffic light supports retrieval of incoming lanes via method traffic.
trafficlight.getControlledLanes (a list of ids)
You can use this to iterate over all vehicles on these lanes and figure out
their types. If you need to correlated lanes with green phasesyou can use
getControlledLinks but you first need to get a good understanding of how
traffic lights are modelled in sumo to make use of the returned values
(http://sumo.dlr.de/wiki/Simulation/Traffic_Lights#Signal_state_definitions)
regards,
Jakob
Hey guys,
I figured out how to iterate all traffic lights using TraCI - pretty straight
forward. But what is the most efficient way to view vehicle types on each
incoming lane at each traffic light??? Putting induction loops on the incoming
lanes of every light seems inefficient and I do not see a way to correlate the
induction loops with the light for easy lookup.
_______________________________________________
sumo-dev mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from
this list, visit
https://dev.eclipse.org/mailman/listinfo/sumo-dev