ROBOTICS 101Concept explainer

Costmaps and Inflation

A costmap gives every cell of the map a cost, not just free or blocked. Cells near obstacles are made expensive, so the planner keeps a comfortable distance instead of scraping past. This inflation is what lets a planner treat a round robot as a single point. Nav2 builds its costmaps this way.

Cost layers

Cells on obstacles are lethal. Cells closer than the robot's radius are inscribed: the robot's body would touch the obstacle there, so they are blocked too. Beyond that, the cost falls off with distance \(d\) up to the inflation radius, following Nav2's formula with decay rate \(k\):

$$c(d) = 252\;e^{-k\,(d - r_{\text{robot}})} \quad \text{for } r_{\text{robot}} < d < r_{\text{inflation}}$$

The planner then finds the path with the lowest total cost, trading length against clearance.

What to notice

Planning on a plain free or blocked map gives the shortest path, which squeezes right past obstacles with no margin. With inflation, the path bends toward the middle of the gaps. A low decay rate spreads the cost far out, making the robot cautious, and a high decay rate keeps the cost tight to the obstacles. A larger robot radius closes narrow gaps entirely.