MyRoboPath
autonomous slam14 min readUpdated 2026-03-08Intermediate

Nav2 Costmaps: Layered Costmaps, Inflation, Obstacles & 3D Voxels

Master Nav2 2D/3D costmap configuration: static layers, obstacle layers, voxel raytracing, inflation radii, and cost scaling factors for safe obstacle clearance.

Dr. Liam Sterling
Dr. Liam Sterling
Head of Autonomous Navigation

Key Engineering Takeaways

  • Costmaps assign values from 0 (Free Space) to 254 (Lethal Obstacle) to guide path planning.
  • The Inflation Layer expands obstacles by the robot inscribed radius plus safety padding to guarantee zero chassis collisions.
  • Voxel Layer clearing clears dynamic obstacles (people walking by) in real time using 3D raytracing.
Prerequisites
  • Nav2 stack basics

The Exponential Inflation Cost Formula

Within the inflation decay zone, the cost value $C$ decays exponentially with distance $d$ from the nearest obstacle: $$C(d) = 253 \times \exp\left(-\text{cost\_scaling\_factor} \times (d - \text{inscribed\_radius})\right)$$
Tags:#Costmaps#Nav2#Inflation Layer#Voxel Layer#Obstacle Avoidance#ROS 2