File Exchange

image thumbnail

Implement Simultaneous Localization and Mapping (SLAM) with

version 1.1.0.0 (113 KB) by Mihir Acharya
Develop a map of an environment and localize the pose of a robot for autonomous navigation.

54 Downloads

Updated 16 Nov 2018

View License

Develop a map of an environment and localize the pose of a robot or a self-driving car for autonomous navigation using Robotics System Toolbox™.
The robot needs to be driven manually when it obtains the LiDAR scans of the environment. On running this code, you can obtain a map of the environment and the pose of the robot relative to the map. This could be further used with commands like buildMap to generate an occupancy grid and perform path planning for autonomous navigation.
Watch the overview video for this functionality here:
https://www.mathworks.com/videos/implement-simultaneous-localization-and-mapping-slam-with-matlab-1520292583530.html

Cite As

Mihir Acharya (2019). Implement Simultaneous Localization and Mapping (SLAM) with (https://www.mathworks.com/matlabcentral/fileexchange/66284-implement-simultaneous-localization-and-mapping-slam-with), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (5)

Harry Chang

Thanks for the code - Though it's not a big thing, I have a small suggestion.
In the code you've used 'mapResolotion'. It may be a small typo so maybe we can use 'mapResolution'.

I have a text file with over 250000 point of rplidar A1 scan. How can I create a MAT file like the offlineSLAMData

Can i directly connect the RPlidar to matlab and perfrom scan to create a map
.

Hello Hammia,
This error occurs when MAT file for offlineSLAMData is not found at the path specified in the code. I have updated the zip file with the required MAT file in the zipped folder and changed the code to read it from there. While the new zip file is getting ready and published, you can try following ways to resolve this error -
1) From the first line of the code. try removing 'data' from the path. Or, if you have access to the MAT file, try loading it from command window using load('offlineSlamData.mat'); and comment out the first two lines in the code which is giving the error.
2) Try running the code from command window by typing - openExample('robotics/OfflineSLAMExample')
Once you run this command, the current folder on the left side in MATLAB will change to the path where the offlineSLAMData is stored.
you can also refer the documentation page for this example here -
https://www.mathworks.com/help/robotics/examples/implement-slam-with-lidar-scans.html
Let me know if this doesn't work.

I tried to run the program but it gives me the following error:
Error using load
Unable to read file 'data\offlineSlamData.mat'. No such file or directory.
Error in SLAM_implementation (line 4)
load(filePath);

Updates

1.1.0.0

Included the offlineSLAMData.mat file in the downloaded zip folder. Earlier it was reading that data from the examples folder where MATLAB is installed.

1.0.0.0

Added Copyright notice in the code file.
Added thumbnail image.

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

SLAM_implementation