Hello,
- you can adapt the speed of the vehicle (up or down) by calling
traci.vehicle.slowDown(vehID, newSpeed, timeToReachNewSpeed)
- you can obtain the state and distance of upcoming traffic lights with
traci.vehicle.getNextTLS
- you can find tutorials for traci use here:
https://sumo.dlr.de/docs/Tutorials/index.html#traci_tutorials
- and a lot of further code examples here:
https://sumo.dlr.de/extractTest.php?path=complex/traci/vehicle
- note, that SUMO also provides the functionality out-of-the-box (if you
need something to compare your algorithm to):
https://sumo.dlr.de/docs/Simulation/GLOSA.html

regards,
Jakob

Am Mi., 22. Juni 2022 um 15:38 Uhr schrieb Βασίλης Β <[email protected]>:

> Greetings. I hope this email finds you well. My apologies for troubling
> you with this email, but I could really use some help on the following, so
> I would like to post the following question if that is ok with you.
>
> Title: "How to control and change the speed of a vehicle approaching a
> traffic light at an intersection, based on the state of the traffic light
> (e.g. if red, yellow or green) in a simple two-lane intersection with
> traffic lights simulation"
>
> Main body: "I am new to SUMO, and I was trying to figure this out for a
> long time on my own, but I am really stuck, although I know this is
> probably very easy for someone with the proper knowledge. What I want to do
> is to provide speed advice (coming from an algorithm that I have created)
> to vehicles that are approaching a traffic light (e.g. if at a distance of
> 300 meters from the light, the light is red, decelerate accordingly, or if
> green, maintain current speed, etc.). I have created a simple simulation
> with a fixed-phased traffic light intersection, with two lanes, with
> vehicles being generated each some seconds with a given probability.
> My guess is that I need to use TraCI for that, but I have failed to do so
> so far, and I also searched for possible similar problems, but couldn't
> find anything. Connecting my algorithm to the simulation and getting the
> speed advice directly seems even more tricky for now, so if you can provide
> some ideas on how I can give manually the "new" speeds of each vehicle
> approaching the traffic light, that would be amazing! Thank you in advance
> for your time and for reading all that, I really appreciate it."
>
> Thank you very much, I really appreciate your help! Have a good day and
> take care.
>
> With respect and appreciation
> Vasilis Volakakis
> _______________________________________________
> sumo-user mailing list
> [email protected]
> To unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/sumo-user
>
_______________________________________________
sumo-user mailing list
[email protected]
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/sumo-user

Reply via email to