(args)
| 420 | |
| 421 | |
| 422 | def main(args): |
| 423 | client = carla.Client(args.host, int(args.port)) |
| 424 | client.set_timeout(60.0) |
| 425 | pygame.init() |
| 426 | |
| 427 | records = {} |
| 428 | maps = [m.replace('/Game/Carla/Maps/', '') for m in client.get_available_maps()] |
| 429 | |
| 430 | for town in sorted(maps): |
| 431 | world = client.load_world(town) |
| 432 | |
| 433 | # set to async mode |
| 434 | settings = world.get_settings() |
| 435 | settings.synchronous_mode = False |
| 436 | settings.fixed_delta_seconds = None |
| 437 | world.apply_settings(settings) |
| 438 | |
| 439 | # spectator pointing to the sky to reduce rendering impact |
| 440 | spectator = world.get_spectator() |
| 441 | spectator.set_transform(carla.Transform(carla.Location(z=500), carla.Rotation(pitch=90))) |
| 442 | |
| 443 | for weather in define_weather(): |
| 444 | world.set_weather(weather["parameter"]) |
| 445 | for env in define_environments(): |
| 446 | for sensors in define_sensors(): |
| 447 | list_fps = run_benchmark(world, sensors, env["vehicles"], env["walkers"], client) |
| 448 | mean, std = compute_mean_std(list_fps) |
| 449 | sensor_str = "" |
| 450 | for sensor in sensors: |
| 451 | sensor_str += (sensor['label'] + " ") |
| 452 | |
| 453 | record = { |
| 454 | 'town': town, |
| 455 | 'sensors': sensor_str, |
| 456 | 'weather': weather["name"], |
| 457 | 'n_vehicles': env["vehicles"], |
| 458 | 'n_walkers': env["walkers"], |
| 459 | 'samples': args.ticks, |
| 460 | 'fps_mean': mean, |
| 461 | 'fps_std': std |
| 462 | } |
| 463 | |
| 464 | env_str = str(env["vehicles"]) + str(env["walkers"]) |
| 465 | |
| 466 | if env_str not in records: |
| 467 | records[env_str] = [] |
| 468 | records[env_str].append(record) |
| 469 | print(record) |
| 470 | |
| 471 | system_specs = get_system_specs() |
| 472 | serialize_records(records, system_specs, args.file) |
| 473 | pygame.quit() |
| 474 | |
| 475 | |
| 476 | if __name__ == '__main__': |
no test coverage detected