import os
import sys
import traci
import matplotlib.pyplot as plt
from sumolib import checkBinary
import datetime
# Path to the SUMO tools (change this according to your setup)
sumo_tools_path = "C:/Program Files (x86)/Eclipse/Sumo/bin"
# Path to the SUMO simulation files (change this according to your setup)
sumo_simulation_path = "C:/Users/Dani/Desktop/sumo_test1/try"
gui = True
max_steps = 2500
# sumo things - we need to import python modules from the $SUMO_HOME/tools directory
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'")
# setting the cmd mode or the visual mode
if gui == False:
sumoBinary = checkBinary('sumo')
else:
sumoBinary = checkBinary('sumo-gui')
# setting the cmd command to run sumo at simulation time
sumo_cmd = [sumoBinary, "-c", os.path.join(sumo_simulation_path, "sumocfg1.sumocfg"), "--no-step-log", "true", "--waiting-time-memory", str(max_steps)]
# Start the SUMO simulation
#sumo_cmd = [os.path.join(sumo_tools_path, "sumo-gui"), "--remote-port", "0", "--start", "-c", os.path.join(sumo_simulation_path, "sumocfg1.sumocfg")]
traci.start(sumo_cmd)