(c, car_agents, bike_agents, pedestrian_agents, statistics)
| 805 | |
| 806 | |
| 807 | def pull_new_agents(c, car_agents, bike_agents, pedestrian_agents, statistics): |
| 808 | |
| 809 | new_car_agents = [] |
| 810 | new_bike_agents = [] |
| 811 | new_pedestrian_agents = [] |
| 812 | |
| 813 | c.crowd_service.acquire_new_cars() |
| 814 | for (actor_id, route_points, steer_angle_range) in c.crowd_service.new_cars: |
| 815 | path = SumoNetworkAgentPath(route_points, PATH_MIN_POINTS, PATH_INTERVAL) |
| 816 | new_car_agents.append(Agent( |
| 817 | c.world.get_actor(actor_id), 'Car', path, 5.0 + c.rng.uniform(-0.5, 0.5), |
| 818 | steer_angle_range, rand=c.rng.uniform(0.0, 1.0))) |
| 819 | c.crowd_service.new_cars = [] |
| 820 | c.crowd_service.spawn_car = len(car_agents) < c.args.num_car |
| 821 | c.crowd_service.release_new_cars() |
| 822 | |
| 823 | c.crowd_service.acquire_new_bikes() |
| 824 | for (actor_id, route_points, steer_angle_range) in c.crowd_service.new_bikes: |
| 825 | path = SumoNetworkAgentPath(route_points, PATH_MIN_POINTS, PATH_INTERVAL) |
| 826 | new_bike_agents.append(Agent( |
| 827 | c.world.get_actor(actor_id), 'Bicycle', path, 3.0 + c.rng.uniform(-0.5, 0.5), |
| 828 | steer_angle_range, rand=c.rng.uniform(0.0, 1.0))) |
| 829 | c.crowd_service.new_bikes = [] |
| 830 | c.crowd_service.spawn_bike = len(bike_agents) < c.args.num_bike |
| 831 | c.crowd_service.release_new_bikes() |
| 832 | |
| 833 | c.crowd_service.acquire_new_pedestrians() |
| 834 | for (actor_id, route_points, route_orientations) in c.crowd_service.new_pedestrians: |
| 835 | path = SidewalkAgentPath(route_points, route_orientations, PATH_MIN_POINTS, PATH_INTERVAL) |
| 836 | path.resize(c.sidewalk, c.args.cross_probability) |
| 837 | new_pedestrian_agents.append(Agent( |
| 838 | c.world.get_actor(actor_id), 'People', path, 1.0 + c.rng.uniform(-0.5, 0.5), |
| 839 | rand=c.rng.uniform(0.0, 1.0))) |
| 840 | c.crowd_service.new_pedestrians = [] |
| 841 | c.crowd_service.spawn_pedestrian = len(pedestrian_agents) < c.args.num_pedestrian |
| 842 | c.crowd_service.release_new_pedestrians() |
| 843 | |
| 844 | statistics.total_num_cars += len(new_car_agents) |
| 845 | statistics.total_num_bikes += len(new_bike_agents) |
| 846 | statistics.total_num_pedestrians += len(new_pedestrian_agents) |
| 847 | |
| 848 | return (car_agents + new_car_agents, bike_agents + new_bike_agents, pedestrian_agents + new_pedestrian_agents, statistics) |
| 849 | |
| 850 | |
| 851 | def do_death(c, car_agents, bike_agents, pedestrian_agents, destroy_list, statistics): |
no test coverage detected