Hi Valentin,
maybe you can try with setRouteID. First you will need to search the edges of the new route, which you can do with findRoute. See
https://sumo.dlr.de/docs/TraCI/Change_Vehicle_State.html and
https://sumo.dlr.de/docs/TraCI/Simulation_Value_Retrieval.html
Regards,
Giuliana
Von: sumo-user-bounces@xxxxxxxxxxx <sumo-user-bounces@xxxxxxxxxxx>
Im Auftrag von Valentin Klamka
Gesendet: Donnerstag, 5. November 2020 15:44
An: Sumo project User discussions <sumo-user@xxxxxxxxxxx>
Betreff: [sumo-user] Edge-List is expanding unnecessarily when I reroute via traci.
So basically I want to drive back and forth:
if (traci.vehicle.getRoadID(vehicle) =='gneE28'):
traci.vehicle.changeTarget(vehicle,'gneE11')
if (traci.vehicle.getRoadID(vehicle) =='gneE11'):
traci.vehicle.changeTarget(vehicle,'gneE28')
when I print (traci.vehicle.getRoute(vehicle)) I see that the Edges-List gets longer, the longer the simulation runs. But to save space I only want to save the edges which I need to reach the destination.
I tried traci.vehicle.setRoute(vehicle,traci.vehicle.getRoadID(vehicle)) to reset the route, but it only appends the new edge to the previously traveled route. Is there a way to reset the route? If not, what is the reason behind it?
|