How to use the libsumo.start function in libsumo

To help you get started, we’ve selected a few libsumo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eclipse / sumo / tests / complex / traci / pythonApi / rerouting / person / stop_walk_stop_walk / runner.py View on Github external
if len(sys.argv) > 1:
    import libsumo as traci  # noqa
else:
    import traci  # noqa
import sumolib  # noqa

sumoBinary = sumolib.checkBinary('sumo')
cmd = [
    sumoBinary,
    "-n", "input_net2.net.xml",
    "-r", "input_routes.rou.xml",
    "--fcd-output", "fcd.xml",
    "--vehroute-output", "vehroutes.xml",
    "--default.speeddev", "0",
    "--no-step-log"]
traci.start(cmd)


def step():
    s = traci.simulation.getTime()
    traci.simulationStep()
    return s


p = "p0"
s = step()
s = step()

while traci.simulation.getMinExpectedNumber() > 0:
    if s == 10:
        traci.person.rerouteTraveltime("p0")
    s = step()

libsumo

The python version of the libsumo API to communicate with the traffic simulation Eclipse SUMO

EPL-2.0
Latest version published 1 month ago

Package Health Score

87 / 100
Full package analysis

Similar packages