Section 28.4: Occupancy grids and voxel maps

For Occupancy grids and voxel maps, geometry earns its place when it changes reachability, clearance, grasping, exploration, or recovery in the log.

A Patient Embodied AI Agent
Scene shows sensor rays carving free cells, occupied cells, and unknown space in a voxel map before a robot plans a path.
Figure 28.4A: Unknown is not free; a map is honest only when it remembers what it has not seen.
Big Picture

Occupancy grids and voxel maps stores where space is free, occupied, or unknown. This representation is humble, but it is one of the most actionable maps for navigation, inspection, drone flight, and collision checking.

Problem First: Why This Representation Exists

For occupancy and voxel maps, track resolution, decay, inflation, unknown-space policy, and update latency. The robot evidence is not map beauty; it is whether the planner used the map to avoid collision or request exploration.

For occupancy and voxel maps, track resolution, decay, inflation, unknown-space policy, and update latency. The robot evidence is not map beauty; it is whether the planner used the map to avoid collision or request exploration. Treat the representation as a typed state estimate, not as a visualization.

Action Is The Unit Of Meaning

For Occupancy grids and voxel maps, the representation is embodied only when it changes an admissible action, safety margin, exploration request, or recovery path.

Figure 28.4.1 should be read as the Occupancy grids and voxel maps handoff diagram: sensor evidence, geometric representation, uncertainty, latency, and action consumer are separate failure points.

Occupancy update from range evidence A robotics perception contract connecting sensor evidence to state, action, and diagnostics. Ray sensor beam Free before hit Hit occupied cell Unknown unseen Planner cost map
Figure 28.4.1: Occupancy update from range evidence. The dashed feedback path reminds the reader that perception quality is judged by action consequences and replayable diagnostics.

Mathematical Core

Occupancy mapping usually updates log odds so repeated evidence accumulates without probabilities saturating too quickly.

Formal Object

$\ell_t(m_i)=\ell_{t-1}(m_i)+\log\frac{P(m_i\mid z_t)}{1-P(m_i\mid z_t)}-\ell_0$

The log-odds value $\ell_t$ increases for occupied evidence and decreases for free-space evidence. Unknown is not free; it is a separate epistemic state that planners should treat according to task risk.

Voxel occupancy update
  1. Cast a ray from the sensor through the measured endpoint.
  2. Decrease occupancy log odds for traversed cells before the hit.
  3. Increase occupancy log odds for the endpoint cell.
  4. Inflate occupied cells by robot radius before planning.
Occupancy Map Design Choices
Design ChoiceUse WhenControl Risk
2D gridGround robots on mostly flat floorsCannot represent overhangs or drone clearance.
3D voxel mapDrones, manipulation, cluttered interiorsMemory and update cost grow quickly.
TSDF or ESDFSurface reconstruction and planning distancesTruncation and integration choices affect thin objects.

Worked Miniature

Code Fragment 28.4.1 performs a tiny log-odds update for free and occupied cells along one range ray. The same idea powers larger occupancy and voxel maps.

# Apply one log-odds occupancy update along a range ray.
# Free cells decrease, the hit cell increases, and unknown cells remain unchanged.
import numpy as np

log_odds = np.zeros(6)
free_cells = [0, 1, 2, 3]
hit_cell = 4
log_odds[free_cells] += -0.4
log_odds[hit_cell] += 0.9
prob = 1 / (1 + np.exp(-log_odds))
print(np.round(prob, 2))
[0.40 0.40 0.40 0.40 0.71 0.50]

The expected output shows cells 1 through 4 moving toward free space, cell 5 accumulating occupied evidence, and cell 6 staying unknown at 0.50. A planner should therefore interpret this vector as "one likely obstacle, several cleared cells, and one unobserved cell," not as a complete map.

Code Fragment 28.4.1: The array separates free evidence, occupied evidence, and unknown space. Cell 5 stays at `0.50`, which matters because a planner should not confuse unseen space with safe space.
Library Shortcut

OctoMap, OpenVDB-style voxel structures, ROS 2 cost maps, and simulator occupancy layers provide maintained implementations. The library route handles memory and ray integration, while the builder defines sensor models, inflation, and unknown-space policy.

Failure Mode To Test

Treating unknown cells as free is a planning choice, not a fact. It may be acceptable for exploration and unacceptable for high-speed navigation or human-adjacent robots.

Practical Example

A warehouse drone should inflate occupied voxels by its body radius and reserve an additional margin for localization uncertainty before accepting a path through shelving.

Memory Hook

For Occupancy grids and voxel maps, the perception result must answer what action changed, what uncertainty changed, and what log would reproduce the decision. Otherwise the output is still visualization, not embodied evidence.

Debugging And Evaluation

For Occupancy grids and voxel maps, evaluate the representation inside the consuming action loop with calibration, frame transform, representation version, latency, selected action, and failure label.

For Occupancy grids and voxel maps, perturb exactly one geometric assumption, such as depth dropout, scale, occlusion, pose drift, motion, or calibration, then record the action change.

Research Frontier

Occupancy maps are being combined with neural scene representations and learned priors. The important research tension is between dense, expressive memory and the hard real-time guarantees needed by planners.

What's Next

Section 28.5 replaces discrete voxels with a continuous neural radiance field, gaining photorealistic novel-view synthesis at the cost of needing an explicit geometry extraction step before the map can answer collision queries.

Section References

Open3D. Voxel grid documentation. https://www.open3d.org/docs/release/tutorial/geometry/voxelization.html

Shows practical voxel representations and conversions.

NVIDIA. Isaac ROS Visual SLAM documentation. https://nvidia-isaac-ros.github.io/repositories_and_packages/isaac_ros_visual_slam/index.html

Visual odometry context for maps that feed navigation.

Self Check

Can you name the representation, the consuming action, the uncertainty or freshness field, and the failure label for Occupancy grids and voxel maps? If any one is missing, the section is not yet ready for a robot replay log.

Key Takeaway

Occupancy grids are powerful because they answer the planner's simplest question: is this space free, occupied, or still unknown?

Exercise 28.4.1

Design an unknown-space policy for a drone inspecting a warehouse aisle. When should unknown be allowed, penalized, or forbidden?