Layered costmaps

Layered costmaps are a data structure used in robotic navigation systems—most notably within the Robot Operating System (ROS) navigation stack—to represent and manage spatial information about an environment’s traversability. A layered costmap consists of multiple stacked two‑dimensional grids (costmaps), each encoding different categories of environmental data. The layers are combined, typically by overlaying their cost values, to produce a composite costmap that the robot’s path‑planning algorithms query when generating motion trajectories.

Structure and Components

  • Static layer: Represents fixed, known obstacles such as walls or permanent structures. This layer is usually derived from a pre‑existing map (e.g., a metric map generated by SLAM) and remains unchanged during operation.
  • Obstacle layer: Dynamically updated with sensor data (e.g., laser scans, depth cameras) to reflect temporary or moving obstacles like people, furniture, or other robots.
  • Inflation layer: Expands the cost values around occupied cells to create a safety buffer, ensuring the robot maintains a minimum distance from obstacles. The inflation radius and cost decay function are configurable.
  • Social, custom, or semantic layers: Optional layers that encode context‑specific information such as human comfort zones, terrain types, or designated no‑go zones. These layers are defined by developers to tailor navigation behavior to particular applications.

Each layer stores cost values on a discretized grid, typically ranging from 0 (free space) to 255 (lethal obstacle). The cost combination rules—often a maximum or additive scheme—determine the final cost for each cell in the composite map.

Operational Workflow

  1. Initialization – The static layer is loaded from a map file; other layers are instantiated with default parameters.
  2. Sensor Update – Incoming sensor messages (e.g., sensor_msgs/LaserScan, sensor_msgs/PointCloud2) are processed by the obstacle layer, which marks newly detected occupied cells and clears cells that become free.
  3. Inflation Update – The inflation layer recomputes cost gradients around newly occupied cells to maintain up‑to‑date safety buffers.
  4. Layer Integration – The navigation stack’s costmap server merges the layers into a unified costmap, exposing it through a ROS service or topic.
  5. Path Planning – Global planners (e.g., navfn, global_planner) and local planners (e.g., dwa_local_planner, teb_local_planner) query the composite costmap to evaluate feasible paths and generate velocity commands.

Applications

  • Autonomous mobile robots navigating warehouses, hospitals, or office environments.
  • Service robots that must avoid people while respecting socially acceptable distances.
  • Agricultural or outdoor robots where terrain classification layers inform speed and maneuverability decisions.

Advantages

  • Modularity: Developers can add, remove, or modify layers without altering the core navigation algorithms.
  • Real‑time adaptability: Dynamic obstacle layers enable rapid response to changes in the environment.
  • Safety: Inflation layers ensure that planned paths respect clearance requirements.

Limitations

  • Computational overhead increases with the number and resolution of layers, potentially affecting real‑time performance on constrained hardware.
  • The 2‑D grid representation may be insufficient for robots operating in highly three‑dimensional spaces (e.g., multilevel structures or aerial drones), where alternative representations such as voxel grids or occupancy octrees are preferred.

Historical Context
The concept of layered costmaps emerged from the development of the ROS navigation stack around 2010, building on earlier robotics research in hierarchical environment representation and cost‑based path planning. The term is now widely used in ROS documentation, academic literature on mobile robot navigation, and commercial robot middleware.

References

  • M. Quigley et al., ROS: an open-source Robot Operating System, ICRA Workshop on Open Source Software, 2009.
  • ROS Navigation Stack documentation, costmap_2d package (maintained by Open Source Robotics Foundation).
  • J. Fox, The ROS Navigation Stack, ROSCon 2014.

This entry reflects information verified up to April 2026.

Browse

More topics to explore