code: def main():
      # We start creating the client
      client = carla.Client("localhost", 2000)
      client.set_timeout(2.0)
      world = client.get_world()
  
      try:
          # We need to save the settings to be able to recover them at the end
          # of the script to leave the server in the same state that we found it.
          original_settings = world.get_settings()
          settings = world.get_settings()
  
          # We set CARLA syncronous mode
          settings.fixed_delta_seconds = 0.05
          settings.synchronous_mode = True
          world.apply_settings(settings)
  
          traffic_manager = client.get_trafficmanager(8000)
          traffic_manager.set_synchronous_mode(True)
  
          # We create the sensor queue in which we keep track of the information
          # already received. This structure is thread safe and can be
          # accessed by all the sensors callback concurrently without problem.
          sensor_queue = Queue()
  
          # Spawning ego vehicle
          actor_BP = world.get_blueprint_library().filter(
              "vehicle.lincoln.mkz_2017"
          )[0]
          car_tr = carla.Transform(
              carla.Location(x=239, y=125, z=0.9),
              carla.Rotation(yaw=-88.5),
          )
          actor = world.spawn_actor(actor_BP, car_tr)
  
          world.tick()
          move_spectator(world, actor)
  
          spawn_prop_vehicles(world)
  
          wait(world, 10)
  
          # We create all the sensors and keep them in a list for convenience.
          sensor_list = []
  
          lidar_bp = world.get_blueprint_library().find(
              "sensor.lidar.ray_cast_semantic"
          )
          lidar_bp.set_attribute("channels", "64")
          lidar_bp.set_attribute("points_per_second", "500000")
          lidar_bp.set_attribute("range", "300")
          lidar_bp.set_attribute("upper_fov", "10.0")
          lidar_bp.set_attribute("lower_fov", "-90.0")
          lidar_tr = carla.Transform(
              carla.Location(z=3), carla.Rotation(yaw=0)
          )
          lidar = world.spawn_actor(lidar_bp, lidar_tr, attach_to=actor)
          lidar.listen(
              lambda data: lidar_callback(
                  data, sensor_queue, "semlidar"
              )
          )
          world.on_tick(
              lambda snapshot: world_callback(
                  snapshot, world, sensor_queue, "bb", actor
              )
          )
          sensor_list.append(lidar)
          sensor_list.append(
              actor
          )  # actor acts as a 'sensor' to simplify bb-lidar data comparison
  
          # Set autopilot for main vehicle
          actor.enable_constant_velocity(carla.Vector3D(20, 0, 0))
  
          for _i in range(0, 100):
              # Tick the server
              world.tick()
              w_frame = world.get_snapshot().frame
              process_sensors(w_frame, sensor_queue, len(sensor_list))
  
          actor.disable_constant_velocity()
  
      finally:
          world.apply_settings(original_settings)
  
          # Destroy all the actors
          destroy_prop_vehicles()
          for sensor in sensor_list:
              sensor.destroy()
  
imports: import glob
  import os
  import sys
  import numpy
  from queue import Queue
  from queue import Empty
  import carla
label_desc: Use image node_id 9 for calling a global function with example usage: main() without return types