Skip to the lesson
FixTheRobot Explore Robotics / Navigation / M6 Local Planning and Obstacle Avoidance / M6-T1

Navigation · Theory · M6

M6-T1 — Local versus Global Planning

One planner knows where to go, the other knows what is in front of it, and navigation works only while they trust each other.

  • Lesson 1 of 7
  • Module 6: Local Planning and Obstacle Avoidance
  • Theory
  • About 7 minutes to read

Scout has a route from the laboratory to the ward, 60 m of it, computed on a map. Halfway down the corridor a linen cart appears. Nobody should replan the whole building for a cart, and nobody should drive into it either. Splitting planning into a slow global planner and a fast local planner is how the stack does both, and most of its strange failures come from the seam between them.

Learning objectives

After this lesson, you should be able to:

  • State the job, the input, the rate and the horizon of the global and the local planner.
  • Describe what the global planner hands to the local planner and what comes back.
  • Size a local window from speed, braking and latency.
  • Explain what happens when the two disagree and name the usual remedies.

The intuition

Think of a driver with a satnav. The satnav knows the whole city and tells you which streets to take, but it does not see the cyclist. The driver sees the cyclist and nothing beyond the next junction. The satnav is the global planner: a path over the whole known map, recomputed rarely. The driver is the local planner: the next second or two, recomputed many times a second, from what the sensors see now.

They split the work because the two jobs pull in opposite directions. Searching the whole map takes time and needs a map that is not too fresh. Reacting to a cart needs the freshest data and no time at all. A planner that does both is either slow to react or short-sighted. The price of the split is an interface, and the interface is where things go wrong: the local planner must follow a path it did not choose, and the global planner must accept that the robot will not follow it exactly.

A global path with a local window that moves along itA long global path runs from the lab to the ward. A small rectangle around the robot is the local costmap. A carrot point on the path ahead is the local goal, and a cart on the path makes the local planner bend around it. start (lab)goal (ward) local window 5 m × 5 m local goalcart global path: whole map, planned about once a second The local planner follows the path inside its window and bends around what the window sees.
The global path (dashed orange) is long and rarely changes. The local planner works in a small moving window, aims at a local goal on the path, and bends around the cart.

The mathematics

Two planners compared

Global and local planning
Global plannerLocal planner
QuestionWhich route reaches the goal?Which velocity is safe and useful right now?
MapThe whole costmap, mostly staticA small rolling window, live sensor data
RateOn demand, or about 1 Hz10 to 50 Hz
HorizonTo the goal (tens of metres)One to a few seconds, or a few metres
OutputA path: a list of posesA velocity command (v, ω)
Knows aboutTopology: which doors and corridors connectDynamics: acceleration limits, moving obstacles

What crosses the interface

  1. Path down: the global path, as a list of poses, and the goal. The local planner picks a local goal on it, usually the point a fixed look-ahead distance ahead of the robot.
  2. Cost down: both read costmaps built from the same layers (lesson M2-T4), but the local costmap is a small window that moves with the robot.
  3. Status up: progress, blocked, and failure. A local planner that cannot move reports it, and the behaviour tree decides whether to replan or recover (lesson M7-T6).

How big must the local window be?

Whatever the window shows must include everything that could matter before the robot can stop. A simple budget is the distance travelled during the sensing-to-command latency, plus the braking distance, plus a margin.

Local window radius
rwindow≥v⋅tlatency+v22⋅abrake+marginr_{\text{window}}\ge v\cdot t_{\text{latency}}+\frac{v^{2}}{2\cdot a_{\text{brake}}}+\text{margin}
v
speed of the robot (m/s).
tlatency
time from a sensor reading to the motor command taking effect (s).
abrake
comfortable braking deceleration (m/s²).

When the two disagree

  • Different footprints or costmaps: the global planner routes through a door the local planner refuses (lab M1-L1).
  • Blocked path, no replan: the local planner is stuck against a cart, the global path still goes through it. The global planner must be asked again with the new obstacle in its costmap.
  • Flip-flop: the local planner bends left around a cart, the global planner, replanning, prefers the right, the robot swings between them. Replan only when the new path is clearly cheaper, or hold the old one for a while (hysteresis).
  • Local minima: the local planner follows its own cost function and can stop in a dead end that the global path would avoid (lesson M6-T2).

A worked example

Sizing Scout’s window. Scout drives at v = 1.0 m/s, brakes at 0.5 m/s², and the delay from laser scan to wheel command is 0.2 s.

Window radius for Scout
v⋅tlatency=1.0×0.2=0.20 mv\cdot t_{\text{latency}}=1.0\times 0.2=0.20\,\mathrm{m}
v22⋅abrake=1.022×0.5=1.00 m\frac{v^{2}}{2\cdot a_{\text{brake}}}=\frac{1.0^{2}}{2\times 0.5}=1.00\,\mathrm{m}
rwindow≥0.20+1.00+margin 0.30=1.50 mr_{\text{window}}\ge 0.20+1.00+\text{margin}\,0.30=1.50\,\mathrm{m}

A 5 m × 5 m window reaches 2.5 m from the robot in the worst direction, so it is enough with a metre to spare. At 1.5 m/s the braking distance grows to 2.25 m and the same window no longer qualifies: the speed limit, not the window, has to give.

Why the window is small. With a 0.05 m cell, the 5 m × 5 m local window has 100 × 100 = 10 000 cells. The 60 m × 40 m global map has 1200 × 800 = 960 000 cells, 96 times more. Updating, inflating and searching ten thousand cells twenty times a second is easy; doing it for nearly a million is not. The window is a budget decision.

Staleness. The global planner runs once a second, so its path can be up to 1 s old: at 1.0 m/s that is up to 1.0 m of travel. The path can therefore never be trusted to be clear of an obstacle that is nearer than a metre or so. The local planner covers the gap, which is why it must run an order of magnitude faster. At 20 Hz it moves the robot 0.05 m per cycle.

The cart. The cart appears 3 m ahead. The local planner sees it on the next scan, and steers around it using the room in its window. If the corridor is too narrow, no local trajectory exists, the progress checker fires after its timeout, and the global planner is asked again with the cart in the map (lab M6-L1 builds the stuck detector).

Engineering implications and limitations

Keep the two costmaps consistent

Same footprint, same inflation parameters, same obstacle sources. The only intended difference is size and update rate. Every other difference is a future incident.

Choose the look-ahead deliberately

The local goal sits a look-ahead distance along the path. Too short and the robot wobbles at every kink of the path; too long and it cuts corners through obstacles the path avoided. Scale it with speed.

Let the local planner stay on the path

A local planner that drifts far from the global path can end up in space the global planner never checked. Penalise distance from the path and cap how far the robot may deviate before it asks for a new plan.

Replan on events, not only on a clock

Periodic replanning at 1 Hz is a baseline. Add triggers: the path now crosses a lethal cell, the robot has made no progress, the goal moved. Add hysteresis so a marginally better path does not cause flip-flop.

Common misconceptions

“The local planner is just a faster global planner.”

It answers a different question over a different horizon and uses velocity limits and moving obstacles, which global search ignores.

“If the global path is collision-free, the robot will be too.”

The path is only as fresh as its last update, and a robot never follows it exactly. Collision avoidance belongs to the layer that sees now.

“A bigger local window is always better.”

It costs time every cycle, and a stale far edge brings in ghosts. Size it from stopping distance and latency.

“Replanning more often fixes oscillation.”

Often the opposite: two planners that disagree flip faster. Add hysteresis or a consistent cost.

Engineering takeaways

  1. The global planner finds a route over the whole map; the local planner finds a safe velocity over the next seconds.
  2. The local planner follows a local goal on the global path, and reports progress or failure upward.
  3. Size the local window from latency, braking distance and a margin; limit speed if the window is too small.
  4. Disagreements come from different footprints, stale paths, flip-flop and local minima.
  5. Replan on events, add hysteresis, and keep both costmaps consistent.

References and further reading

The Navigation 2 papers and documentation, and the classic local-planning papers.

  • S. Macenski, F. Martín, R. White and J. Ginés Clavero, “The Marathon 2: A Navigation System”, IEEE/RSJ IROS, 2020.
  • E. Marder-Eppstein, E. Berger, T. Foote, B. Gerkey and K. Konolige, “The Office Marathon: Robust Navigation in an Indoor Office Environment”, IEEE ICRA, 2010.
  • S. Quinlan and O. Khatib, “Elastic Bands: Connecting Path Planning and Control”, IEEE ICRA, 1993.
  • Nav2 documentation, “Concepts” and “Configuration Guide”, docs.nav2.org.

Knowledge check

Three conceptual questions. Write an answer, then reveal the explanation. Your answers stay in your browser.

Question 1

Scout drives at 0.8 m/s, brakes at 0.4 m/s², and has 0.25 s of latency. What is the smallest local window radius, with a 0.3 m margin?

Explanation

0.8 × 0.25 = 0.20 m; 0.8² / (2 × 0.4) = 0.80 m; with the margin 0.20 + 0.80 + 0.30 = 1.30 m.

Question 2

The local planner stops in front of a cart in a corridor that is too narrow to pass, and the global path still goes through the cart. Which component must act, and on what information?

Explanation

The global planner must replan (usually triggered by the progress checker or by a lethal cell on the path), with the cart in its costmap, so that it finds another route or reports no path.

Question 3

A 0.05 m grid has a 4 m × 4 m local window and a 40 m × 30 m global map. How many times more cells does the global map have?

Explanation

Local: 80 × 80 = 6400 cells. Global: 800 × 600 = 480 000 cells. The ratio is 75.

What’s next

Next: the simplest local planner, forces from the goal and the obstacles, and the way it gets stuck.

Next lesson

M6-T2 — Potential Fields and Local Minima

Build an attractive-plus-repulsive field and show with an example why a robot can get stuck.

Nothing below is required to finish this lesson.