()
| 389 | |
| 390 | |
| 391 | def main(): |
| 392 | actor_list = [] |
| 393 | pygame.init() |
| 394 | pygame.display.set_caption( |
| 395 | 'IBISCape: Multi-modal Data Acquisition Framework') |
| 396 | |
| 397 | display = pygame.display.set_mode( |
| 398 | (1200, 450), |
| 399 | pygame.HWSURFACE | pygame.DOUBLEBUF) |
| 400 | font = get_font() |
| 401 | clock = pygame.time.Clock() |
| 402 | |
| 403 | iterator = 1 |
| 404 | rvrs = False |
| 405 | hand_brake = False |
| 406 | |
| 407 | try: |
| 408 | start_Pose = m.get_spawn_points() |
| 409 | start_pose = start_Pose[32] |
| 410 | waypoint = m.get_waypoint(start_pose.location) |
| 411 | |
| 412 | vehicle, camera_rgb, camera_depth, Gnss_sensor = create_main_actors(start_pose, waypoint) |
| 413 | file_veh_sim = open(os.path.join(path11, '%s_simulation.txt' % |
| 414 | get_actor_display_name(vehicle, truncate=200)), "a") |
| 415 | file_associate = open(os.path.join(path11, 'association.txt'),"a") |
| 416 | |
| 417 | actor_list.append(vehicle) |
| 418 | actor_list.append(camera_rgb) |
| 419 | actor_list.append(camera_depth) |
| 420 | actor_list.append(Gnss_sensor) |
| 421 | |
| 422 | # Create a synchronous mode context. |
| 423 | with CarlaSyncMode(world, camera_rgb, camera_depth, fps=20) as sync_mode: |
| 424 | |
| 425 | while True: |
| 426 | |
| 427 | for event in pygame.event.get(): |
| 428 | if event.type == pygame.QUIT: |
| 429 | pygame.quit() |
| 430 | elif event.type == pygame.KEYDOWN: |
| 431 | if event.key == K_r: |
| 432 | self.recording = not self.recording |
| 433 | elif event.key == K_q: |
| 434 | rvrs = not rvrs |
| 435 | elif event.key == K_SPACE: |
| 436 | vehicle.disable_constant_velocity() |
| 437 | vehicle.apply_control( |
| 438 | carla.VehicleControl(hand_brake=not hand_brake)) |
| 439 | elif event.key == K_w: |
| 440 | if rvrs: |
| 441 | vehicle.apply_control( |
| 442 | carla.VehicleControl(reverse=True, brake=0.0)) |
| 443 | vehicle.enable_constant_velocity( |
| 444 | carla.Vector3D(-3, 0, 0)) |
| 445 | else: |
| 446 | vehicle.apply_control( |
| 447 | carla.VehicleControl(throttle=1.0, brake=0.0)) |
| 448 | vehicle.enable_constant_velocity( |
no test coverage detected