Navigation and Control

What Is a Costmap? How Robots Choose Where to Travel.

By Rodolfo Garcia Calderoni, CFA ·

On this pageWhat Is a Costmap?Key TakeawaysHow Does a Costmap Work?Global vs. Local CostmapsWhat Is Costmap Inflation?Frequently Asked QuestionsThe Bottom LineSourcesRelated terms

What Is a Costmap?

A costmap is a representation of an environment in which different locations are assigned numerical costs that help a robot determine where it should travel.

Costmaps are widely used in autonomous mobile robot navigation.

Instead of simply identifying which areas are occupied and which are empty, a costmap can represent how desirable or difficult a particular route may be.

For example, a robot navigating a warehouse may assign a very high cost to an occupied aisle and a lower cost to an open corridor.

Key Takeaways

  • Costmaps help robots evaluate possible routes by assigning costs to areas of their environment.
  • Obstacles, nearby hazards, restricted zones, and other considerations can influence cost values.
  • Navigation algorithms use costmaps to select paths that balance reaching the destination with avoiding undesirable areas.

How Does a Costmap Work?

Imagine a warehouse floor divided into thousands of small grid cells.

Each cell represents a location.

The navigation software assigns values to the cells based on information from maps, sensors, and operating rules.

A free area may receive a low cost.

An obstacle may receive a very high cost or be considered impassable.

Areas near obstacles may receive intermediate values, encouraging the robot to maintain clearance rather than pass unnecessarily close.

The path planner then evaluates possible routes through the grid.

Global vs. Local Costmaps

Many mobile robots use two different costmaps.

A global costmap represents a larger area and supports planning a route toward the destination.

A local costmap represents the nearby environment and helps the robot respond to immediate obstacles and movement constraints.

For example, a global costmap may guide a robot across a warehouse.

Its local costmap may help it navigate around a cart temporarily parked in an aisle.

The two systems work together to support navigation.

What Is Costmap Inflation?

Costmap inflation increases the cost of traveling close to obstacles.

Consider a robot passing beside a warehouse shelf.

Even if the robot can technically fit through a narrow space, traveling too close to the shelf may create unnecessary collision risk.

Inflation assigns elevated costs around the obstacle, encouraging the planner to select paths with more clearance when possible.

The appropriate clearance depends on the robot's dimensions and navigation configuration.

Frequently Asked Questions

Is a costmap the same as a map?

No. A map represents information about the environment. A costmap adds values that help a navigation system evaluate movement through it.

Can costmaps change while a robot moves?

Yes. Local costmaps can be updated using information from cameras, LiDAR, and other sensors.

The Bottom Line

Costmaps help autonomous robots turn environmental information into practical navigation decisions. They allow path planners to consider obstacles, clearance, and other route preferences rather than simply choosing the shortest geometric path.

Sources

  1. Nav2 — Costmap 2D
  2. Nav2 — Inflation Layer

Black Scarab Weekly

Follow the physical AI economy

Get Black Scarab news, deep research, and practical analysis in one clear Thursday briefing.

Weekly reporting and deep dives. Unsubscribe anytime. See our privacy notice.