code: def main():
      argparser = argparse.ArgumentParser(
          description="CARLA Sensor tutorial"
      )
      argparser.add_argument(
          "--host",
          metavar="H",
          default="127.0.0.1",
          help="IP of the host server (default: 127.0.0.1)",
      )
      argparser.add_argument(
          "-p",
          "--port",
          metavar="P",
          default=2000,
          type=int,
          help="TCP port to listen to (default: 2000)",
      )
      argparser.add_argument(
          "--sync",
          action="store_true",
          help="Synchronous mode execution",
      )
      argparser.add_argument(
          "--async",
          dest="sync",
          action="store_false",
          help="Asynchronous mode execution",
      )
      argparser.set_defaults(sync=True)
      argparser.add_argument(
          "--res",
          metavar="WIDTHxHEIGHT",
          default="1280x720",
          help="window resolution (default: 1280x720)",
      )
      argparser.add_argument(
          "-lp",
          "--lidar_points",
          metavar="LP",
          default="100000",
          help='lidar points per second (default: "100000")',
      )
      argparser.add_argument(
          "-ln",
          "--lidar_number",
          metavar="LN",
          default=3,
          type=int,
          choices=range(0, 4),
          help="Number of lidars to render (from zero to three)",
      )
      argparser.add_argument(
          "-slp",
          "--semanticlidar_points",
          metavar="SLP",
          default="100000",
          help='semantic lidar points per second (default: "100000")',
      )
      argparser.add_argument(
          "-sln",
          "--semanticlidar_number",
          metavar="SLN",
          default=0,
          type=int,
          choices=range(0, 4),
          help="Number of semantic lidars to render (from zero to three)",
      )
      argparser.add_argument(
          "-rp",
          "--radar_points",
          metavar="RP",
          default="100000",
          help='radar points per second (default: "100000")',
      )
      argparser.add_argument(
          "-rn",
          "--radar_number",
          metavar="LN",
          default=0,
          type=int,
          choices=range(0, 4),
          help="Number of radars to render (from zero to three)",
      )
      argparser.add_argument(
          "--camera",
          dest="render_cam",
          action="store_true",
          help="render also RGB camera (camera enable by default)",
      )
      argparser.add_argument(
          "--no-camera",
          dest="render_cam",
          action="store_false",
          help="no render RGB camera (camera disable by default)",
      )
      argparser.set_defaults(render_cam=True)
      argparser.add_argument(
          "--profiling",
          action="store_true",
          help="Use the script in profiling mode. It measures the performance of \
           the lidar for different number of points.",
      )
      argparser.set_defaults(profiling=False)
      argparser.add_argument(
          "--no-render-window",
          action="store_false",
          dest="render_window",
          help="Render visualization window.",
      )
      argparser.set_defaults(render_window=True)
  
      args = argparser.parse_args()
  
      args.width, args.height = [int(x) for x in args.res.split("x")]
  
      try:
          client = carla.Client(args.host, args.port)
          client.set_timeout(5.0)
  
          if args.profiling:
              print(
                  "-------------------------------------------------------"
              )
              print(
                  "# Running profiling with %s lidars, %s semantic lidars and %s radars."
                  % (
                      args.lidar_number,
                      args.semanticlidar_number,
                      args.radar_number,
                  )
              )
              args.render_cam = False
              args.render_window = False
              runs_output = []
  
              points_range = [
                  "100000",
                  "200000",
                  "300000",
                  "400000",
                  "500000",
                  "600000",
                  "700000",
                  "800000",
                  "900000",
                  "1000000",
                  "1100000",
                  "1200000",
                  "1300000",
                  "1400000",
                  "1500000",
              ]
              for points in points_range:
                  args.lidar_points = points
                  args.semanticlidar_points = points
                  args.radar_points = points
                  run_str = one_run(args, client)
                  runs_output.append(run_str)
  
              print(
                  "-------------------------------------------------------"
              )
              print(
                  "# Profiling of parallel raycast sensors (LiDAR and Radar)"
              )
              try:
                  import multiprocessing
  
                  print(
                      "#Number of cores: %d"
                      % multiprocessing.cpu_count()
                  )
              except ImportError:
                  print(
                      "#Hardware information not available, please install the "
                      "multiprocessing module"
                  )
  
              print(
                  "#NumLidars NumSemLids NumRadars PointsPerSecond FPS     PercentageProcessing"
              )
              for o in runs_output:
                  print(o)
  
          else:
              one_run(args, client)
  
      except KeyboardInterrupt:
          print("\nCancelled by user. Bye!")
  
imports: import glob
  import os
  import sys
  import carla
  import argparse
  import random
  import time
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: main() without return types