Main Content

Mapping and Localization

Lidar scan mapping, and particle filter localization

Create maps of environments using occupancy grids and localize using a sampling-based recursive Bayesian estimation algorithm using lidar sensor data from your robot.


expand all

binaryOccupancyMapCreate occupancy grid with binary values
getOccupancyGet occupancy value of locations
inflateInflate each occupied location
moveMove map in world frame (Since R2019b)
occupancyMatrixConvert occupancy grid to matrix
raycastCompute cell indices along a ray (Since R2019b)
lidarScanCreate object for storing 2-D lidar scan (Since R2019b)
plotDisplay laser or lidar scan readings
removeInvalidDataRemove invalid range and angle data
transformScanTransform laser scan based on relative pose
stateEstimatorPFCreate particle filter state estimator
initializeInitialize the state of the particle filter
predictPredict state of robot in next time step
correctAdjust state estimate based on sensor measurement
getStateEstimateExtract best state estimate and covariance from particles



  • Occupancy Grids
    Details of occupancy grid functionality and map structure.

State Estimation

  • Particle Filter Parameters
    To use the stateEstimatorPF particle filter, you must specify parameters such as the number of particles, the initial particle location, and the state estimation method.
  • Particle Filter Workflow
    A particle filter is a recursive, Bayesian state estimator that uses discrete particles to approximate the posterior distribution of the estimated state.