Hello, SUMO community, I would appreciate any help on my issue.
In my scenario, I want vehicles to stop for several seconds when they enter a specific edge and then resume driving. For that, I am using TraCI with the ‘setStop’ function and a dictionary to store the ‘hasStopped’ value for vehicles that have already stopped. But after making a stop, the vehicle does not resume driving and the simulation runs indefinitely. What could be the problem here? Best Regards, Danil Here is my code: class EvaluationVehicle: """Data container class for the individual vehicles. Stores all relevant data for the Evaluation vehicle-related.""" def __init__(self, id, type): self.id = id self.type = type self.hasStopped = False def run(): start = datetime.now() print(str(datetime.now())) # create empty dictionaries to store data vehicleMap = {} # begin and end times of the simulation in seconds from 00:00 begin = 0 end = 4000 seed = 1 # set parking entrance edge ID and parking exit edge ID pEntrEdgeID = "988716348.13" nextToEntryID = "988716348.13.3" # start Traci traci.start(["sumo-gui", "-n", "osm_1.net.xml", "-r", "osm.bicycle.trips.xml", "-a", "parking.add.xml", "--step-length", "0.25", "--delay", "250", "--parking.maneuver", "true", "-b", f"{begin}", "-e", f"{end}", "--seed", f"{seed}"]) while traci.simulation.getMinExpectedNumber() > 0: traci.simulationStep() # get the list of vehicles currently in the simulation vehIdList = traci.vehicle.getIDList() # loop over each vehicle in the simulation for vehicle_id in vehIdList: vehEdgeID = traci.vehicle.getRoadID(vehicle_id) vehType = traci.vehicle.getTypeID(vehicle_id) # check if the vehicle ID is not in vehicleMap if vehicle_id not in vehicleMap: # if not, create an EvaluationVehicle object for the vehicle and store it in vehicleMap vehicleMap[str(vehicle_id)] = EvaluationVehicle(str(vehicle_id), str(vehType)) # If the vehicle enters the edge and has not stopped before, stop it for a specific time if vehEdgeID == pEntrEdgeID and not vehicleMap[str(vehicle_id)].hasStopped: stop_time = 2 traci.vehicle.setStop(vehID=vehicle_id, edgeID=nextToEntryID, pos=1, laneIndex=0, duration=stop_time, flags=2) vehicleMap[str(vehicle_id)].hasStopped = True # close simulation traci.close() if __name__ == '__main__': run()
_______________________________________________ sumo-user mailing list sumo-user@eclipse.org To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user