Here's a clear and professional email you can send:
Dear SUMO community,
I’m currently working on a simulation involving parking area
and have encountered an issue with dynamic rerouting using
TraCI.
I have successfully created and tested a rerouter file
(included below), which ensures that vehicles reroute among
the parking areas of a particular group. This setup is
functioning as expected.
<additional>
<rerouter id="pa_D1" edges="-E1" probability="1" parking.distanceto.weight="1" parking.timeto.weight="1" parking.anywhere="10">
<interval begin="0" end="43200">
<parkingAreaReroute id="pa_0" visible="false" />
<parkingAreaReroute id="pa_1" visible="false" />
<parkingAreaReroute id="pa_2" visible="false" />
<parkingAreaReroute id="pa_3" visible="false" />
<parkingAreaReroute id="pa_4" visible="false" />
<parkingAreaReroute id="pa_5" visible="false" />
</interval>
</rerouter>
<rerouter id="pa_D2" edges="E22" probability="1" parking.distanceto.weight="1" parking.timeto.weight="1" parking.anywhere="10">
<interval begin="0" end="43200">
<parkingAreaReroute id="pa_6" visible="false" />
<parkingAreaReroute id="pa_7" visible="false" />
<parkingAreaReroute id="pa_8" visible="false" />
<parkingAreaReroute id="pa_9" visible="false" />
<parkingAreaReroute id="pa_10" visible="false" />
<parkingAreaReroute id="pa_11" visible="false" />
</interval>
</rerouter>
<rerouter id="pa_D3" edges="E12" probability="1" parking.distanceto.weight="1" parking.timeto.weight="1" parking.anywhere="10">
<interval begin="0" end="43200">
<parkingAreaReroute id="pa_12" visible="false" />
<parkingAreaReroute id="pa_13" visible="false" />
<parkingAreaReroute id="pa_14" visible="false" />
<parkingAreaReroute id="pa_15" visible="false" />
<parkingAreaReroute id="pa_16" visible="false" />
<parkingAreaReroute id="pa_17" visible="false" />
</interval>
</rerouter>
</additional>
However, I now want to extend the rerouting logic to allow
vehicles to reroute across different parking groups
during the simulation using TraCI. I’m using the following
code snippet for this purpose:
for veh_id, pa in pa_dict.items():
pa_edge = traci.lane.getEdgeID(traci.parkingarea.getLaneID(pa))
current_route = list(traci.vehicle.getRoute(veh_id))
current_destination = current_route[-1]
if traci.vehicle.getStops(veh_id):
traci.vehicle.rerouteParkingArea(veh_id, pa)
else:
if pa_edge in current_route:
traci.vehicle.rerouteParkingArea(veh_id, pa)
else:
if pa_edge != current_destination:
new_route = current_route[:-1] + [pa_edge, current_destination]
else:
new_route = current_route
traci.vehicle.setRoute(veh_id, new_route)
traci.vehicle.rerouteParkingArea(veh_id, pa)
Despite executing this command, the vehicle continues to loop
within the parking areas of its original group
until a space becomes available, at which point it parks
there. It does not switch to a parking area
in another group, even when explicitly instructed to.
Could you kindly advise:
-
Why might this be happening?
-
How can I debug or trace whether changeTarget()
is being applied correctly?
-
Are there any additional constraints (e.g., active
rerouter settings or routing mode) that could override
this command?
Any guidance on how to ensure that the vehicle responds to
TraCI-based rerouting as expected would be greatly
appreciated.
Best regards,
Rohan Verma