Hello, right know your question has the flavour of: "read my code and help me with programming" whereas this mailing list is for "help me with a specific sumo question". Please see https://sumo.dlr.de/docs/FAQ.html#i_want_to_do_a_project_with_sumo_can_you_help_me_with_the_implementation and maybe try to rephrase your question. regards, Jakob
Am Fr., 8. Mai 2020 um 10:40 Uhr schrieb swaroop <[email protected]>: > Hi, > I am working on developing Parking system for autonomous vehicles. I have > generated random traffic using randomtrips.py > I also generated parking lots as you suggested last time using > generateparking.py > > Now I would like to know how can i randomly get a vehicle parked in this > generated parking and randomly resume. > > I have idea of generating the parking and resuming the vehicle at a given > time stamp. > > > if step == 3: > add_vehicle(vehicles[0]) > if step == 5: > add_vehicle(vehicles[1]) > if step == 100: > empty_slot(1,vehicles[0]) > if step == 170: > empty_slot(2,vehicles[1]) > > > with Add vehicle and empty slot being: > > def add_vehicle(vehicle): > global occupied, total_capacity, slot > if occupied < total_capacity: > slotid= get_empty_slot() > slot[slotid]= vehicle > slotid= slotid+1 > print("vehicle is parked", vehicle, "slotid", slotid) > traci.vehicle.setParkingAreaStop(vehicle, "parkingLot") > # traci.vehicle.setStop(vehicles, "e1", pos=38.0) > occupied= occupied +1 > return slotid > else: > print("Slots not available") > return -1 > > > def empty_slot(slotid,vehicle): > global occupied, slot > if occupied>0 and slot[slotid-1] != -1: > slot[slotid-1] = -1 > occupied = occupied - 1 > traci.vehicle.resume(vehicle) > return True > else: > return False > > Please let me know. > > Regards, > Swaroop > > > > -- > Sent from: http://sumo-user-mailing-list.90755.n8.nabble.com/ > _______________________________________________ > sumo-user mailing list > [email protected] > To unsubscribe from this list, visit > https://www.eclipse.org/mailman/listinfo/sumo-user >
_______________________________________________ sumo-user mailing list [email protected] To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
