Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Issue with Dynamic Parking Rerouting Using TraCI

Dear Rohan,

traci.vehicle.rerouteParkingArea should already update the route, so there is no need to do that separately. Btw the attributes starting with "parking." are only interpreted for vehicles/vehicle types.  

I was not able to reproduce your problem with a small scenario. Did you debug if your script logic & parking area dictionary are correct at first? If yes, you may provide a small failing example scenario + script for further investigation.

Best regards,
Mirko


Am 22.06.2025 um 13:03 schrieb Rohan Verma via sumo-user:

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:

  1. Why might this be happening?

  2. How can I debug or trace whether changeTarget() is being applied correctly?

  3. 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


_______________________________________________
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