code: def main():
      argparser = argparse.ArgumentParser()
      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(
          "-i",
          "--info",
          action="store_true",
          help="Show text information",
      )
      argparser.add_argument(
          "-x",
          default=0.0,
          type=float,
          help="X start position (default: 0.0)",
      )
      argparser.add_argument(
          "-y",
          default=0.0,
          type=float,
          help="Y start position (default: 0.0)",
      )
      argparser.add_argument(
          "-z",
          default=0.0,
          type=float,
          help="Z start position (default: 0.0)",
      )
      argparser.add_argument(
          "-s",
          "--seed",
          metavar="S",
          default=os.getpid(),
          type=int,
          help="Seed for the random path (default: program pid)",
      )
      argparser.add_argument(
          "-t",
          "--tick-time",
          metavar="T",
          default=0.2,
          type=float,
          help="Tick time between updates (forward velocity) (default: 0.2)",
      )
      args = argparser.parse_args()
  
      try:
          client = carla.Client(args.host, args.port)
          client.set_timeout(2.0)
  
          world = client.get_world()
          m = world.get_map()
          debug = world.debug
  
          random.seed(args.seed)
          print("Seed: ", args.seed)
  
          loc = carla.Location(args.x, args.y, args.z)
          print("Initial location: ", loc)
  
          current_w = m.get_waypoint(loc)
  
          # main loop
          while True:
              # list of potential next waypoints
              potential_w = list(current_w.next(waypoint_separation))
  
              # check for available right driving lanes
              if current_w.lane_change & carla.LaneChange.Right:
                  right_w = current_w.get_right_lane()
                  if (
                      right_w
                      and right_w.lane_type == carla.LaneType.Driving
                  ):
                      potential_w += list(
                          right_w.next(waypoint_separation)
                      )
  
              # check for available left driving lanes
              if current_w.lane_change & carla.LaneChange.Left:
                  left_w = current_w.get_left_lane()
                  if (
                      left_w
                      and left_w.lane_type == carla.LaneType.Driving
                  ):
                      potential_w += list(
                          left_w.next(waypoint_separation)
                      )
  
              # choose a random waypoint to be the next
              next_w = random.choice(potential_w)
              potential_w.remove(next_w)
  
              # Render some nice information, notice that you can't see the strings if you are using an editor camera
              if args.info:
                  draw_waypoint_info(debug, current_w, trail_life_time)
              draw_waypoint_union(
                  debug,
                  current_w,
                  next_w,
                  cyan if current_w.is_junction else green,
                  trail_life_time,
              )
              draw_transform(
                  debug, current_w.transform, white, trail_life_time
              )
  
              # print the remaining waypoints
              for p in potential_w:
                  draw_waypoint_union(
                      debug, current_w, p, red, trail_life_time
                  )
                  draw_transform(
                      debug, p.transform, white, trail_life_time
                  )
  
              # draw all junction waypoints and bounding box
              if next_w.is_junction:
                  junction = next_w.get_junction()
                  draw_junction(debug, junction, trail_life_time)
  
              # update the current waypoint and sleep for some time
              current_w = next_w
              time.sleep(args.tick_time)
  
      finally:
          pass
  
file_path: carla/PythonAPI/util/lane_explorer.py
imports: import glob
  import os
  import sys
  import carla
  import argparse
  import random
  import time
label_desc: Use image node_id 5 for calling a global function with example usage: main() without return types