Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Adding traffic lights automatically

I'd advise against editing the XML with regular expressions. Seriously, you can do a lot of harm with regular expressions because very often the pattern is either too restrictive or too loose. Please rather use netconvert to add traffic lights:

  • either call netconvert with option --tls.guess true
  • or collect the concerned intersections beforehand (e.g. using sumolib) and provide their IDs to netconvert using --tls.set

Best regards

Mirko

 

 

 

 

 

-----Original-Nachricht-----

Betreff: Re: [sumo-user] Adding traffic lights automatically

Datum: 2023-10-21T20:50:03+0200

Von: "Manuel H. Rosales via sumo-user" <sumo-user@xxxxxxxxxxx>

An: "Sumo project User discussions" <sumo-user@xxxxxxxxxxx>

 

 

 

Hi Toprak, I hope you are fine.
You can do with a script TRACI before to run the simulation an edition of the archive .net.xml
and using regular expressions add traffic lights in the necessary places and with the required conditions
 
if __name__ == "__main__":
    options = get_options()
//here for example you can edit with Python and modify the .net.xml file
    if options.nogui:
        sumoBinary = checkBinary('sumo')
    else:
        sumoBinary = checkBinary('sumo-gui')

    traci.start([sumoBinary, "-c", "archivo.sumocfg",
                             "--tripinfo-output", "tripinfo.xml"])
    run()
 
Please tell me if you need more help.
 
Saludos cordiales
Mat. Manuel Hernández Rosales
Secretario Técnico
Programa Universitario de Estudios sobre la Ciudad
Universidad Nacional Autónoma de México
Ciudad de México, México
Whats App: 5539621430

El sáb, 21 oct 2023 a las 7:14, Toprak via sumo-user (<sumo-user@xxxxxxxxxxx>) escribió:
Hello,
 
I want to automatically add traffic lights into the network without manually inserting them in netedit. I am currently generating grid networks and want to add the traffic lights on all junctions. Is there a way to achieve this? I actually would be happier with a system that adds traffic lights with respect to how many roads there are in the junction, so that the corners which have only 2 roads (1 in and 1 out) don’t have traffic lights but other junctions do. If no, maybe I need to write a small python script which modifies the network file?
 
I checked out the wiki but couldn’t find an answer and —guess true doesn’t do the trick apparently. 
Thanks,
Toprak
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user

 



Back to the top