File Exchange

2D Local Grid Map

version 1.0.0.0 (1.15 MB) by
This code is a Matlab implementation of 2D Local Grid Map

Updated 31 Aug 2015

In this experiment, L by L meters surrounding environment of a mobile robot is presented in the form of a grid. The data is acquired using a 2D laser range finder (LRF) mounted in front of a robot to scan horizontal plane. The 2D laser range finder provides 180 points per reading, 1 point per degree. Range data further than 40 meters is disregarded since it may contain false measurement caused by laser beam passing through glass or mirror reflection. Laser hitting points located inside the local grid are directly used for computing the local grid, and points outside the local grid (> 10m) and within the threshold (< 40m) are interpolated and points on the border of the local grid are used instead. The desired end points input to the Bresenham's line algorithm to indicate free and occupied cells. Bresenham's line algorithm determines which cells on the 2-dimensional grid should be selected to form a close approximation to a straight line between laser origin and end point. The end points on the boarder of the local grid map are used to determine free cells and end points positioned inside the grid are used to determine free and occupied cells. For having a consistent local map it is needed to continuously integrate a new local grid into the previous local grid map. This is done by rotation and translation of the previous grid map on the new computed grid. The difference between the robot poses in two consecutive frames is used to compute the transformation matrix. The odometry data provides robot's pose. The robot pose is defined by (x, y, \theta) where x and y are coordinates relative to some known start point and \theta is the robot's heading. After transformation, it is needed to update the map values. Free and occupancy counters are defined, and counter values are updated using Reflectation mapping policy: C = hit /(hit + miss). Where hit represents the number of times a beam ended in that cell while miss stands for the number of times a beam passed through that grid cell.
---------------------------------------------------------------
Inputs are: laser range data (L) and estimated odometry (X)
Output is: local occupancy grid map
The functions are:
init - initialize mapping
mp - build current local grid map from laser data
prc - load and pre-process data
shw - show grid map, laser points, robot locations, and current robot direction
trns - transform map t-1 on map t
upd - update current local map
---------------------------------------------------------------
The code runs on Linux/Windows with MATLAB R2013a
it needs "Piotr's Image&Video Toolbox Version 3.01" for transformation
a dataset "localized.data" is included so you can simply run Demo.m
The data used in this work comes from the robotics course by Dr. Mohan Sridharan
Here you can see the video result:

Cite As

Alireza (2020). 2D Local Grid Map (https://www.mathworks.com/matlabcentral/fileexchange/52749-2d-local-grid-map), MATLAB Central File Exchange. Retrieved .

songming chen

Jack Chen

very good!

faiza gul

When I try to run it it does not work

Joao Henriques

Nice and short demo, also easy to run (if you read the instructions that say it needs Piotr's toolbox ;) )

Nuwan Disanayaka

Nuwan Disanayaka

NUTALAPATI KRISHNA

I'm getting the following error when running demo file. Can you please resolve the issue.
----------------------------------------------------------------------->

Error using getPrmDflt (line 50)
prm must be a struct or a cell

Error in imtransform2 (line 69)
getPrmDflt(varargin,dfs,1);

Error in trns (line 34)
mapt = imtransform2(map + 1, H,'nearest');
% transformation ( + 1! help us to find
indexes easier )

Error in init (line 22)
tmap = trns(map, X, i, i + st, gs); %
transform map t - 1 (on the map t)

Error in Demo_LocalMap (line 25)
[fc, oc] = init(i, X, Lx, Ly, trsh, gs,
sz, st); % initialize mapping

Alireza

You need "Piotr's Image&Video Toolbox Version 3.01" for transformation (imtransform2)

thanks for ur work but i cant find the function
mapt = imtransform2(map + 1, H, 'method', 'nearest');

MATLAB Release Compatibility
Created with R2013a
Compatible with any release
Platform Compatibility
Windows macOS Linux