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: :param vehicle: actor to apply to local planner logic onto
  :param opt_dict: dictionary of arguments with different parameters:
      dt: time between simulation steps
      target_speed: desired cruise speed in Km/h
      sampling_radius: distance between the waypoints part of the plan
      lateral_control_dict: values of the lateral PID controller
      longitudinal_control_dict: values of the longitudinal PID controller
      max_throttle: maximum throttle applied to the vehicle
      max_brake: maximum brake applied to the vehicle
      max_steering: maximum steering applied to the vehicle
      offset: distance between the route waypoints and the center of the lane
  :param map_inst: carla.Map instance to avoid the expensive call of getting it.
docstr_tok: [":","param","vehicle",":","actor","to","apply","to","local","planner","logic","onto",":","param","opt_dict",":","dictionary","of","arguments","with","different","parameters",":","dt",":","time","between","simulation","steps","target_speed",":","desired","cruise","speed","in","Km\/h","sampling_radius",":","distance","between","the","waypoints","part","of","the","plan","lateral_control_dict",":","values","of","the","lateral","PID","controller","longitudinal_control_dict",":","values","of","the","longitudinal","PID","controller","max_throttle",":","maximum","throttle","applied","to","the","vehicle","max_brake",":","maximum","brake","applied","to","the","vehicle","max_steering",":","maximum","steering","applied","to","the","vehicle","offset",":","distance","between","the","route","waypoints","and","the","center","of","the","lane",":","param","map_inst",":","carla.Map","instance","to","avoid","the","expensive","call","of","getting","it","."]
code: def __init__(self, vehicle, opt_dict={}, map_inst=None):
      """
      :param vehicle: actor to apply to local planner logic onto
      :param opt_dict: dictionary of arguments with different parameters:
          dt: time between simulation steps
          target_speed: desired cruise speed in Km/h
          sampling_radius: distance between the waypoints part of the plan
          lateral_control_dict: values of the lateral PID controller
          longitudinal_control_dict: values of the longitudinal PID controller
          max_throttle: maximum throttle applied to the vehicle
          max_brake: maximum brake applied to the vehicle
          max_steering: maximum steering applied to the vehicle
          offset: distance between the route waypoints and the center of the lane
      :param map_inst: carla.Map instance to avoid the expensive call of getting it.
      """
      self._vehicle = vehicle
      self._world = self._vehicle.get_world()
      if map_inst:
          if isinstance(map_inst, carla.Map):
              self._map = map_inst
          else:
              print(
                  "Warning: Ignoring the given map as it is not a 'carla.Map'"
              )
              self._map = self._world.get_map()
      else:
          self._map = self._world.get_map()
  
      self._vehicle_controller = None
      self.target_waypoint = None
      self.target_road_option = None
  
      self._waypoints_queue = deque(maxlen=10000)
      self._min_waypoint_queue_length = 100
      self._stop_waypoint_creation = False
  
      # Base parameters
      self._dt = 1.0 / 20.0
      self._target_speed = 20.0  # Km/h
      self._sampling_radius = 2.0
      self._args_lateral_dict = {
          "K_P": 1.95,
          "K_I": 0.05,
          "K_D": 0.2,
          "dt": self._dt,
      }
      self._args_longitudinal_dict = {
          "K_P": 1.0,
          "K_I": 0.05,
          "K_D": 0,
          "dt": self._dt,
      }
      self._max_throt = 0.75
      self._max_brake = 0.3
      self._max_steer = 0.8
      self._offset = 0
      self._base_min_distance = 3.0
      self._distance_ratio = 0.5
      self._follow_speed_limits = False
  
      # Overload parameters
      if opt_dict:
          if "dt" in opt_dict:
              self._dt = opt_dict["dt"]
          if "target_speed" in opt_dict:
              self._target_speed = opt_dict["target_speed"]
          if "sampling_radius" in opt_dict:
              self._sampling_radius = opt_dict["sampling_radius"]
          if "lateral_control_dict" in opt_dict:
              self._args_lateral_dict = opt_dict["lateral_control_dict"]
          if "longitudinal_control_dict" in opt_dict:
              self._args_longitudinal_dict = opt_dict[
                  "longitudinal_control_dict"
              ]
          if "max_throttle" in opt_dict:
              self._max_throt = opt_dict["max_throttle"]
          if "max_brake" in opt_dict:
              self._max_brake = opt_dict["max_brake"]
          if "max_steering" in opt_dict:
              self._max_steer = opt_dict["max_steering"]
          if "offset" in opt_dict:
              self._offset = opt_dict["offset"]
          if "base_min_distance" in opt_dict:
              self._base_min_distance = opt_dict["base_min_distance"]
          if "distance_ratio" in opt_dict:
              self._distance_ratio = opt_dict["distance_ratio"]
          if "follow_speed_limits" in opt_dict:
              self._follow_speed_limits = opt_dict[
                  "follow_speed_limits"
              ]
  
      # initializing controller
      self._init_controller()
  
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 1 to create a new LocalPlanner object from inherited base classes: object with example: obj = LocalPlanner(vehicle, opt_dict, map_inst)