import os
import sys
import optparse
import traci
if 'SUMO_HOME' in os.environ:
tools = os.path.join(os.environ['SUMO_HOME'], 'tools')
sys.path.append(tools)
else:
sys.exit("please declare environment variable 'SUMO_HOME'")
from sumolib import checkBinary
def get_options():
optParser = optparse.OptionParser()
optParser.add_option("--nogui", action="store_true",
default=False, help="run the commandline version of sumo")
options, args = optParser.parse_args()
return options
if __name__ == "__main__":
options = get_options()
if options.nogui:
sumoBinary = checkBinary('sumo')
else:
sumoBinary = checkBinary('sumo-gui')
traci.start([sumoBinary, "-c", "osm.sumocfg"])
for step in range(0,1500):
print(traci.vehicle.getSpeed('veh0'))
traci.simulationStep()
traci.close()
cd C:/Users/cooki/sumo/tools/2020-11-11-11-46-21
command = 'python C:/Users/cooki/sumo/tools/2020-11-11-11-46-21/runner.py';
status = dos(command);