Intermediate

AV Planning

Design planning systems that generate safe, comfortable, and efficient driving trajectories through complex traffic environments.

The Three Layers of Planning

🗺

Route Planning

High-level navigation from point A to B using road networks. Uses graph search (A*, Dijkstra) on HD maps with traffic and road closure awareness.

🧠

Behavior Planning

Decide high-level driving actions: follow lane, change lanes, turn, yield, stop. Uses finite state machines or learned decision models.

📈

Motion Planning

Generate smooth, collision-free trajectories that follow the behavior decision. Optimizes for safety, comfort, and efficiency.

Behavior Planning

The behavior planner acts as the "decision brain" of the autonomous vehicle, choosing appropriate driving behaviors based on the current situation:

class BehaviorPlanner:
    """Simplified finite state machine for AV behavior planning."""

    STATES = ['FOLLOW_LANE', 'PREPARE_LANE_CHANGE',
              'LANE_CHANGE_LEFT', 'LANE_CHANGE_RIGHT',
              'STOP', 'YIELD']

    def __init__(self):
        self.state = 'FOLLOW_LANE'

    def update(self, ego_state, perception_data, map_data):
        if self.state == 'FOLLOW_LANE':
            if self._should_change_lane(ego_state, perception_data):
                self.state = 'PREPARE_LANE_CHANGE'
            elif self._approaching_stop(ego_state, map_data):
                self.state = 'STOP'

        elif self.state == 'PREPARE_LANE_CHANGE':
            if self._lane_change_safe(ego_state, perception_data):
                self.state = 'LANE_CHANGE_LEFT'
            elif self._abort_lane_change(perception_data):
                self.state = 'FOLLOW_LANE'

        return self.state

Trajectory Generation

Motion planners generate trajectories — sequences of (x, y, heading, velocity, time) points that the vehicle should follow:

  • Lattice planners: Sample candidate trajectories from a pre-computed lattice and select the best one
  • Polynomial trajectories: Fit quintic polynomials for smooth lateral and longitudinal motion
  • Optimization-based: Minimize a cost function balancing safety, comfort, efficiency, and rule compliance
  • Learning-based: End-to-end neural networks that output trajectories directly from sensor data

Prediction: Anticipating Other Road Users

Safe planning requires predicting what other vehicles, pedestrians, and cyclists will do:

ApproachDescriptionPros/Cons
Constant velocityAssume objects continue at current speed/directionSimple but inaccurate at intersections
Intent predictionPredict high-level intent (turn, lane change)Better accuracy, requires training data
Trajectory predictionPredict future trajectories with uncertaintyMost accurate, computationally expensive
Interaction-awareModel how agents influence each otherHandles complex scenarios, most difficult

HD Maps

High-definition maps provide centimeter-accurate road geometry, lane markings, traffic signs, and semantic information that the planner relies on:

  • Road topology: Lane connectivity, intersections, merge/split points
  • Geometry: Precise lane boundaries, road curvature, elevation
  • Semantics: Speed limits, turn restrictions, crosswalks, stop lines
  • Localization features: Landmarks for precise positioning
Key takeaway: Planning in autonomous driving is a hierarchical problem. Route planning handles navigation, behavior planning makes driving decisions, and motion planning generates safe trajectories. Prediction of other road users is critical for safe interaction in traffic.