Main Content

Build Occupancy Map from Lidar Scans and Poses

The buildMap function takes in lidar scan readings and associated poses to build an occupancy grid as lidarScan objects and associated [x y theta] poses to build an occupancyMap.

Load scan and pose estimates collected from sensors on a robot in a parking garage. The data collected is correlated using a lidarSLAM algorithm, which performs scan matching to associate scans and adjust poses over the full robot trajectory. Check to make sure scans and poses are the same length.

load scansAndPoses.mat
length(scans) == length(poses)
ans = logical
   1

Build the map. Specify the scans and poses in the buildMap function and include the desired map resolution (10 cells per meter) and the max range of the lidar (19.2 meters). Each scan is added at the associated poses and probability values in the occupancy grid are updated.

occMap = buildMap(scans,poses,10,19.2);
figure
show(occMap)
title('Occupancy Map of Garage')