class_docstr: LocalPlanner implements the basic behavior of following a
  trajectory of waypoints that is generated on-the-fly.
  
  The low-level motion of the vehicle is computed by using two PID controllers,
  one is used for the lateral control and the other for the longitudinal control (cruise speed).
  
  When multiple paths are available (intersections) this local planner makes a random choice,
  unless a given global plan has already been specified.
class_docstr_tok: ["LocalPlanner","implements","the","basic","behavior","of","following","a","trajectory","of","waypoints","that","is","generated","on-the-fly",".","The","low-level","motion","of","the","vehicle","is","computed","by","using","two","PID","controllers",",","one","is","used","for","the","lateral","control","and","the","other","for","the","longitudinal","control","(","cruise","speed",")",".","When","multiple","paths","are","available","(","intersections",")","this","local","planner","makes","a","random","choice",",","unless","a","given","global","plan","has","already","been","specified","."]
docstr: Adds a new plan to the local planner. A plan must be a list of [carla.Waypoint, RoadOption] pairs
  The 'clean_queue` parameter erases the previous plan if True, otherwise, it adds it to the old one
  The 'stop_waypoint_creation' flag stops the automatic creation of random waypoints
  
  :param current_plan: list of (carla.Waypoint, RoadOption)
  :param stop_waypoint_creation: bool
  :param clean_queue: bool
  :return:
docstr_tok: ["Adds","a","new","plan","to","the","local","planner",".","A","plan","must","be","a","list","of","[","carla.Waypoint",",","RoadOption","]","pairs","The","'clean_queue","`","parameter","erases","the","previous","plan","if","True",",","otherwise",",","it","adds","it","to","the","old","one","The","'stop_waypoint_creation","'","flag","stops","the","automatic","creation","of","random","waypoints",":","param","current_plan",":","list","of","(","carla.Waypoint",",","RoadOption",")",":","param","stop_waypoint_creation",":","bool",":","param","clean_queue",":","bool",":","return",":"]
code: def set_global_plan(
      self, current_plan, stop_waypoint_creation=True, clean_queue=True
  ):
      """
      Adds a new plan to the local planner. A plan must be a list of [carla.Waypoint, RoadOption] pairs
      The 'clean_queue` parameter erases the previous plan if True, otherwise, it adds it to the old one
      The 'stop_waypoint_creation' flag stops the automatic creation of random waypoints
  
      :param current_plan: list of (carla.Waypoint, RoadOption)
      :param stop_waypoint_creation: bool
      :param clean_queue: bool
      :return:
      """
      if clean_queue:
          self._waypoints_queue.clear()
  
      # Remake the waypoints queue if the new plan has a higher length than the queue
      new_plan_length = len(current_plan) + len(self._waypoints_queue)
      if new_plan_length > self._waypoints_queue.maxlen:
          new_waypoint_queue = deque(maxlen=new_plan_length)
          for wp in self._waypoints_queue:
              new_waypoint_queue.append(wp)
          self._waypoints_queue = new_waypoint_queue
  
      for elem in current_plan:
          self._waypoints_queue.append(elem)
  
      self._stop_waypoint_creation = stop_waypoint_creation
  
imports: from enum import IntEnum
  from collections import deque
  import random
  import carla
  from agents.navigation.controller import VehiclePIDController
  from agents.tools.misc import draw_waypoints, get_speed
label_desc: Use image node_id 7 for calling the LocalPlanner obj's underlying member method code with example usage: obj.set_global_plan(current_plan, stop_waypoint_creation, clean_queue) without return types