DEV Community

vmodal_ai
vmodal_ai

Posted on

Building Global and Local Path Planners for Autonomous Robots

Building Global and Local Path Planners for Autonomous Robots

Autonomous navigation is not just about finding a route from A to B. A robot must plan a useful route through a map and continuously adapt that route to obstacles, other robots, people, and changes in its environment.

A practical navigation system therefore separates global planning from local planning.

Global vs Local Planning

             Global Map
                 |
                 v
        +------------------+
        | Global Planner   |
        +------------------+
                 |
                 v
          Global Path
                 |
                 v
        +------------------+
Sensors>| Local Planner    |
        +------------------+
                 |
                 v
          Velocity Commands
                 |
                 v
               Robot
Enter fullscreen mode Exit fullscreen mode

Global Planner

The global planner considers the larger environment.

Its job is typically to find a route such as:

Start ---> Corridor ---> Door ---> Room ---> Goal
Enter fullscreen mode Exit fullscreen mode

Common approaches include:

  • A*
  • Dijkstra
  • Graph search
  • Grid-based planning
  • Sampling-based planning

Local Planner

The local planner operates closer to the robot and reacts to current observations.

It considers:

  • Nearby obstacles
  • Robot velocity
  • Robot footprint
  • Dynamic objects
  • Current trajectory
  • Short-term goal direction

Why Both Are Needed

Suppose the global path is:

Robot -----> Hallway -----> Goal
Enter fullscreen mode Exit fullscreen mode

A person suddenly walks into the hallway.

The global route may still be valid, but the robot needs to slow down, stop, or temporarily move around the person.

That is the local planner's job.

Grid-Based Global Planning

Represent the environment as a costmap:

. . . . . . .
. . # # . . .
. . # # . . .
. . . . . . .
. . . . . G .
S . . . . . .
Enter fullscreen mode Exit fullscreen mode

A planner searches through free cells while assigning higher costs to undesirable regions.

Local Planning

A local planner can generate multiple candidate trajectories:

             obstacle
                ###
Robot -->    /  |  \ 
            /   |              /    |           candidate trajectories
Enter fullscreen mode Exit fullscreen mode

Each trajectory can be scored based on:

  • Collision risk
  • Distance to path
  • Distance to goal
  • Smoothness
  • Velocity
  • Clearance

ROS 2 Architecture

/map
  |
  v
/global_planner
  |
  v
/global_plan
  |
  v
/local_planner <--- /scan /pointcloud
  |
  v
/cmd_vel
Enter fullscreen mode Exit fullscreen mode

Keep the global and local planners modular so they can be tested independently.

Production Considerations

Monitor:

  • Planning latency
  • Path validity
  • Obstacle updates
  • Controller frequency
  • Recovery behavior
  • Localization quality

A robust navigation system should also have explicit recovery behavior when no safe local trajectory can be found.

Practical Design

Start with:

  1. A reliable map.
  2. A global planner.
  3. A local costmap.
  4. A local trajectory generator.
  5. Collision checking.
  6. Velocity limits.
  7. Recovery behaviors.
  8. Continuous monitoring.

The strongest navigation systems do not choose between global and local planning. They use both at different spatial and temporal scales.

Useful Links

Top comments (0)