Advertisement
Guest User

Untitled

a guest
Mar 4th, 2020
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. #create subject in SUMO
  2. traci.person.add("subject", "CL", 80)
  3. traci.person.appendWalkingStage("subject", ["CL", "RC"], 60)
  4.  
  5. #new iteration in SUMO
  6. traci.simulationStep()
  7.  
  8. while traci.simulation.getMinExpectedNumber() > 0:
  9.     #receive subject position from Unity
  10.     message = socket.recv()
  11.     subject = json.loads(message)
  12.  
  13.     #move subject to new position
  14.     traci.person.moveToXY("subject", subject.edge, subject.x, subject.y, angle=subject.angle, keepRoute=3)
  15.  
  16.     #send position information of other pedestrians and vehicles to Unity
  17.     send = sumoDataToUnity()
  18.     socket.send_string(send)
  19.    
  20.     #new iteration in SUMO
  21.     traci.simulationStep()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement