Search code examples
pythonsumo

How do I use randomTrips.py or other tools to generate pedestrians which travel same distance


I am working on using SUMO and traci to simulate the trajectory of pedestrians. Now I need generate pedestrains which walk the same distance from same origin but reach different destination. How can I get those pedestrians meet the requiements?


Solution

  • You can give custom edge weights to randomTrips.py. In your case the easiest way is probably to create a file say weights.src.xml with the following content:

    <edge id="mysrc" value="1"/>
    

    This will give mysrc probability 1 for being chosen as src and all other edges 0. Then you can use the following call:

    $SUMO_HOME/tools/randomTrips.py -n net.net.xml --weights-prefix weights --min-distance 1000 --max-distance 1500 --persontrips --validate
    

    Please be aware that the distance is beeline distance and not walking distance. Depending on your network this may or may not be a good approximation.