Hi Jakob,
Thank you for your reply. I’ve managed to find another workaround which I thought I’d share on here. The code is not pretty but it
seems to solve the issue:
##***CHANGE THE ROUTE OF A PERSON DURING SIMULATION***##
#STEP1: GET THE EDGE ID OF PERSON
edgeid = traci.person.getRoadID("ped1")
#STEP2: CALCULATE NEW ROUTE FOR PERSON
#myroute = traci.simulation.findRoute(edgeid,NewEndEdgeID,PedestrianVType,-1,0)
myroute = traci.simulation.findRoute(edgeid,"95612610","ped_pedestrian1",-1,0)
#STEP3: GET LIST OF EDGES FROM NEW ROUTE INFORMATION
temp1 = str(myroute).split('edges=(',1)
temp2 = temp1[1].split('), travelTime=',1)
temp3 = temp2[0].replace("'","")
edge_list = temp3.split(',')
myedges = []
for temp_edge in edge_list:
if ':' not in temp_edge: #this condition removes the junction parts from the route list
myedges.append(temp_edge.lstrip().rstrip())
#STEP4: REMOVE STAGES FOR PEDESTRIANS
traci.person.removeStages("ped1") # I assume this resets/clears the pedestrian values
#STEP5: ADD NEW WALKING STAGE FOR PEDESTRIAN WITH NEW ROUTE
traci.person.appendWalkingStage("ped1",myedges,0, duration=-1, speed=-1, stopID='')
Maybe this will be useful for others if they wish to use it.
Kind regards,
Barry
From: sumo-user-bounces@xxxxxxxxxxx <sumo-user-bounces@xxxxxxxxxxx>
On Behalf Of Jakob Erdmann
Sent: Tuesday, 10 March 2020 8:15 PM
To: Sumo project User discussions <sumo-user@xxxxxxxxxxx>
Subject: Re: [sumo-user] Rerouting pedestrians in model
As a workaround you can use TraCI to trigger pedestrian rerouting (traci.person.rerouteTraveltime).
Hi all,
I apologise if this question has been asked already. I’ve been trying to reroute pedestrians in my sumo model using the re-router method. For some reason, unlike that of traffic
when the pedestrians move onto an edge declared by the rerouter they continue on their pre-existing route.
Does anyone have a simple example of how to do the re-routing with pedestrians? I’ve looked online and could not find any work arounds. I’ve been trying this sort of setup in my
additional file whereby an edge in front of the pedestrian is closed and I assign them a new destination to reach. This however does not work.
<additional xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://sumo-sim.org/xsd/additional_file.xsd">
<rerouter id="reroute1" edges="688077234#0 688077234#2 688077234#3 688077234#4 688077234#0 -364040558#7">
<interval begin="30" end="6000">
<closingReroute id="-364040558#5" disallow="all"/>
<destProbReroute id="-85383958#0" probability="1.0"/>
</interval>
</rerouter>
</additional>
It’s likely I’m missing something obvious. Any thoughts or suggestions would be greatly appreciated.
Kind regards,
Barry
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/sumo-user