[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
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.
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 <namdre.sumo@xxxxxxxxx>
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
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.