code: def one_run(args, client):
      """This function performed one test run using the args parameters
      and connecting to the carla client passed.
      """
  
      display_manager = None
      vehicle = None
      vehicle_list = []
      prof_str = ""
      timer = CustomTimer()
  
      try:
          # Getting the world and
          world = client.get_world()
  
          if args.sync:
              traffic_manager = client.get_trafficmanager(8000)
              settings = world.get_settings()
              traffic_manager.set_synchronous_mode(True)
              settings.synchronous_mode = True
              settings.fixed_delta_seconds = 0.05
              world.apply_settings(settings)
  
          if args.profiling:
              settings.no_rendering_mode = True
              world.apply_settings(settings)
  
          # Instanciating the vehicle to which we attached the sensors
          bp = world.get_blueprint_library().filter("vehicle")[0]
  
          if bp.has_attribute("color"):
              color = random.choice(
                  bp.get_attribute("color").recommended_values
              )
              bp.set_attribute("color", color)
  
          vehicle = world.spawn_actor(
              bp, world.get_map().get_spawn_points()[0]
          )
          vehicle_list.append(vehicle)
  
          vehicle.set_autopilot(True)
  
          # Display Manager organize all the sensors an its display in a window
          display_manager = DisplayManager(
              grid_size=[2, 2],
              window_size=[args.width, args.height],
              show_window=args.render_window,
          )
  
          # If require, we instanciate the RGB camera
          if args.render_cam:
              SensorManager(
                  world,
                  display_manager,
                  "RGBCamera",
                  carla.Transform(carla.Location(x=1.5, z=2.4)),
                  vehicle,
                  {},
                  [0, 0],
              )
  
          # If any, we instanciate the required lidars
          lidar_points_per_second = args.lidar_points
  
          if args.lidar_number >= 3:
              SensorManager(
                  world,
                  display_manager,
                  "LiDAR",
                  carla.Transform(carla.Location(x=0, z=2.4)),
                  vehicle,
                  {
                      "channels": "64",
                      "range": "50",
                      "points_per_second": lidar_points_per_second,
                      "rotation_frequency": "20",
                  },
                  [1, 0],
              )
  
          if args.lidar_number >= 2:
              SensorManager(
                  world,
                  display_manager,
                  "LiDAR",
                  carla.Transform(carla.Location(x=0, z=2.4)),
                  vehicle,
                  {
                      "channels": "64",
                      "range": "100",
                      "points_per_second": lidar_points_per_second,
                      "rotation_frequency": "20",
                  },
                  [0, 1],
              )
  
          if args.lidar_number >= 1:
              SensorManager(
                  world,
                  display_manager,
                  "LiDAR",
                  carla.Transform(carla.Location(x=0, z=2.4)),
                  vehicle,
                  {
                      "channels": "64",
                      "range": "200",
                      "points_per_second": lidar_points_per_second,
                      "rotation_frequency": "20",
                  },
                  [1, 1],
              )
  
          # If any, we instanciate the required semantic lidars
          semanticlidar_points_per_second = args.semanticlidar_points
  
          if args.semanticlidar_number >= 3:
              SensorManager(
                  world,
                  display_manager,
                  "SemanticLiDAR",
                  carla.Transform(carla.Location(x=0, z=2.4)),
                  vehicle,
                  {
                      "channels": "64",
                      "range": "50",
                      "points_per_second": semanticlidar_points_per_second,
                      "rotation_frequency": "20",
                  },
                  [1, 0],
              )
  
          if args.semanticlidar_number >= 2:
              SensorManager(
                  world,
                  display_manager,
                  "SemanticLiDAR",
                  carla.Transform(carla.Location(x=0, z=2.4)),
                  vehicle,
                  {
                      "channels": "64",
                      "range": "100",
                      "points_per_second": semanticlidar_points_per_second,
                      "rotation_frequency": "20",
                  },
                  [0, 1],
              )
  
          if args.semanticlidar_number >= 1:
              SensorManager(
                  world,
                  display_manager,
                  "SemanticLiDAR",
                  carla.Transform(carla.Location(x=0, z=2.4)),
                  vehicle,
                  {
                      "channels": "64",
                      "range": "200",
                      "points_per_second": semanticlidar_points_per_second,
                      "rotation_frequency": "20",
                  },
                  [1, 1],
              )
  
          # If any, we instanciate the required radars
          radar_points_per_second = args.radar_points
  
          if args.radar_number >= 3:
              SensorManager(
                  world,
                  display_manager,
                  "Radar",
                  carla.Transform(
                      carla.Location(x=0, z=2.4),
                      carla.Rotation(pitch=5, yaw=90),
                  ),
                  vehicle,
                  {"points_per_second": radar_points_per_second},
                  [2, 2],
              )
  
          if args.radar_number >= 2:
              SensorManager(
                  world,
                  display_manager,
                  "Radar",
                  carla.Transform(
                      carla.Location(x=0, z=2.4),
                      carla.Rotation(pitch=5, yaw=-90),
                  ),
                  vehicle,
                  {"points_per_second": radar_points_per_second},
                  [2, 2],
              )
  
          if args.radar_number >= 1:
              SensorManager(
                  world,
                  display_manager,
                  "Radar",
                  carla.Transform(
                      carla.Location(x=0, z=2.4),
                      carla.Rotation(pitch=5),
                  ),
                  vehicle,
                  {"points_per_second": radar_points_per_second},
                  [2, 2],
              )
  
          call_exit = False
          time_init_sim = timer.time()
  
          frame = 0
          time0 = timer.time()
  
          while True:
              frame += 1
  
              # Carla Tick
              if args.sync:
                  world.tick()
              else:
                  world.wait_for_tick()
  
              # Render received data
              display_manager.render()
  
              # Time measurement for profiling or to output
              if not args.profiling:
                  if frame == 30:
                      time_frames = timer.time() - time0
                      time_procc = 0
                      for sensor in display_manager.sensor_list:
                          time_procc += sensor.time_processing
  
                      print(
                          "FPS: %.3f %.3f %.3f"
                          % (
                              time_frames,
                              1.0 / time_frames * 30,
                              time_procc / time_frames,
                          )
                      )
                      frame = 0
                      for sensor in display_manager.sensor_list:
                          sensor.time_processing = 0
                          sensor.tics_processing = 0
                      time0 = timer.time()
  
                  if args.render_window:
                      for event in pygame.event.get():
                          if event.type == pygame.QUIT:
                              call_exit = True
                          elif event.type == pygame.KEYDOWN:
                              if (
                                  event.key == K_ESCAPE
                                  or event.key == K_q
                              ):
                                  call_exit = True
                                  break
              else:
                  if (timer.time() - time_init_sim) < 5.0:
                      frame = 0
                      for sensor in display_manager.sensor_list:
                          sensor.time_processing = 0
                          sensor.tics_processing = 0
                      time0 = timer.time()
  
                  if (timer.time() - time0) > 10.0:
                      time_frames = timer.time() - time0
  
                      time_procc = 0
                      for sensor in display_manager.sensor_list:
                          time_procc += sensor.time_processing
                      prof_str = (
                          "%-10s %-9s  %-9s %-15s %-7.2f %-20.3f"
                          % (
                              args.lidar_number,
                              args.semanticlidar_number,
                              args.radar_number,
                              lidar_points_per_second,
                              float(frame) / time_frames,
                              time_procc / time_frames,
                          )
                      )
                      break
  
              if call_exit:
                  break
  
      finally:
          if display_manager:
              display_manager.destroy()
  
          client.apply_batch(
              [carla.command.DestroyActor(x) for x in vehicle_list]
          )
  
          if args.sync:
              settings = world.get_settings()
              settings.synchronous_mode = False
              settings.fixed_delta_seconds = None
              world.apply_settings(settings)
  
          if args.profiling:
              settings.no_rendering_mode = False
              world.apply_settings(settings)
  
      return prof_str
  
imports: import glob
  import os
  import sys
  import carla
  import argparse
  import random
  import time
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: one_run(args, client) and returns: prof_str