code: def main():
      argparser = argparse.ArgumentParser(
          description="CARLA Manual Control Client"
      )
      argparser.add_argument(
          "--fov", default=60, type=int, help="FOV for camera"
      )
      argparser.add_argument(
          "--res",
          metavar="WIDTHxHEIGHT",
          # default='1920x1080',
          default="800x600",
          help="window resolution (default: 800x600)",
      )
      args = argparser.parse_args()
  
      args.width, args.height = [int(x) for x in args.res.split("x")]
  
      actor_list = []
      pygame.init()
  
      display = pygame.display.set_mode(
          (args.width, args.height), pygame.HWSURFACE | pygame.DOUBLEBUF
      )
      font = get_font()
      clock = pygame.time.Clock()
  
      client = carla.Client("localhost", 2000)
      client.set_timeout(5.0)
  
      world = client.get_world()
  
      # spawn a camera
      camera_bp = world.get_blueprint_library().find(
          "sensor.camera.rgb"
      )
      camera_bp.set_attribute("image_size_x", str(args.width))
      camera_bp.set_attribute("image_size_y", str(args.height))
      camera_bp.set_attribute("fov", str(args.fov))
      camera = world.spawn_actor(camera_bp, carla.Transform())
  
      # spawn a pedestrian
      world.set_pedestrians_seed(1235)
      ped_bp = random.choice(
          world.get_blueprint_library().filter("walker.pedestrian.*")
      )
      trans = carla.Transform()
      trans.location = world.get_random_location_from_navigation()
      ped = world.spawn_actor(ped_bp, trans)
      walker_controller_bp = world.get_blueprint_library().find(
          "controller.ai.walker"
      )
      controller = world.spawn_actor(
          walker_controller_bp, carla.Transform(), ped
      )
      controller.start()
      controller.go_to_location(
          world.get_random_location_from_navigation()
      )
      controller.set_max_speed(1.7)
  
      # keep tracking of actors to remove
      actor_list.append(camera)
      actor_list.append(ped)
      actor_list.append(controller)
  
      # get some attributes from the camera
      image_w = camera_bp.get_attribute("image_size_x").as_int()
      image_h = camera_bp.get_attribute("image_size_y").as_int()
      fov = camera_bp.get_attribute("fov").as_float()
  
      try:
          pool = Pool(processes=5)
          # Create a synchronous mode context.
          with CarlaSyncMode(world, camera, fps=30) as sync_mode:
              # set the projection matrix
              K = build_projection_matrix(image_w, image_h, fov)
  
              blending = 0
              turning = 0
              while True:
                  if should_quit():
                      return
                  clock.tick()
  
                  # make some transition from custom pose to animation
                  ped.blend_pose(math.sin(blending))
  
                  # move the pedestrian
                  blending += 0.015
                  turning += 0.009
  
                  # move camera around
                  trans = ped.get_transform()
                  x = math.cos(turning) * -3
                  y = math.sin(turning) * 3
                  trans.location.x += x
                  trans.location.y += y
                  trans.location.z = 2
                  trans.rotation.pitch = -16
                  trans.rotation.roll = 0
                  trans.rotation.yaw = -360 * (turning / (math.pi * 2))
                  camera.set_transform(trans)
  
                  # Advance the simulation and wait for the data.
                  snapshot, image_rgb = sync_mode.tick(timeout=5.0)
  
                  # Draw the display.
                  buffer = get_image_as_array(image_rgb)
  
                  # get the pedestrian bones
                  bones = ped.get_bones()
  
                  # prepare the bones (get name and world position)
                  boneIndex = {}
                  points = []
                  for i, bone in enumerate(bones.bone_transforms):
                      boneIndex[bone.name] = i
                      points.append(bone.world.location)
  
                  # project the 3d points to 2d screen
                  points2d = get_screen_points(
                      camera, K, image_w, image_h, points
                  )
  
                  # draw the skeleton lines
                  draw_skeleton(
                      buffer,
                      image_w,
                      image_h,
                      boneIndex,
                      points2d,
                      (0, 255, 0),
                      2,
                  )
  
                  # draw the bone points
                  draw_points_on_buffer(
                      buffer,
                      image_w,
                      image_h,
                      points2d[1:],
                      (255, 0, 0),
                      4,
                  )
  
                  draw_image(display, buffer)
                  # pool.apply_async(write_image, (snapshot.frame, "ped", buffer))
  
                  # display.blit(font.render('%d bones' % len(points), True, (255, 255, 255)), (8, 10))
  
                  pygame.display.flip()
  
      finally:
          # time.sleep(5)
          print("destroying actors.")
          for actor in actor_list:
              actor.destroy()
          pygame.quit()
          pool.close()
          print("done.")
  
imports: import glob
  import os
  import sys
  import math
  import argparse
  import copy
  import time
  from multiprocessing import Pool
  from PIL import Image
  import carla
  import random
label_desc: Use image node_id 11 for calling a global function with example usage: main() without return types