# Grid based SLAM using BeagleBone Green Wireless and RPLIDAR

I've written a grid based DFS algorithm with a PID-based steering system to maneuver a 30cm2 square-grid maze all in Python. The robot is a 4 wheel drive with an approximate size of 20 cm. The robot has a BeagleBone Green Wireless controller which is connected by USB to the RPLIDAR A1.

At this current moment, the robot is underutilizing the LIDAR and I want to begin to learn SLAM. However, the environment is highly predictable which I think makes a full SLAM counterintuitive. I would also like the code to be low CPU strain.

I've seen people converting a conventional SLAM into a grid based but only after the calculations are complete. I was wondering if there is a way to do a Grid Based SLAM right from the start (assume its position and map with a grid).

Accuracy isn't hugely important here as long as it understands a tile and the robot is able to avoid walls.

Any advice, tips or suggestion is appreciated. How would you store the map? How would you locate the position of the robot? How would you map the LIDAR's values?

I have little experience with SLAM but I have played with Bitmaps in python and they sound like they could be used as a means of storing the map. A bitmap is fundamentally a 2D array in which you can change the "pixels" to show walls and other objects in your maze. If you do a scale of 30:1 to store the grid map.

There are two methods of storing the slam data in bitmaps.

1. A 2D array of "tiles" (bitmaps) sized 10 x 10 bits that can be formatted to show "walls"
2. A huge single bitmap

You can learn more about bitmaps in Python here, How do I create a BMP file with pure Python?. If you need an example of a bitmap this image will help What a Bitmap Looks Like.

I would highly recommend you to go through "Improved Techniques for Grid Mapping With Rao-Blackwellized Particle Filters" by Grisetti, Stachniss, and Burgard. There is quite a good implementation of it which can found at the OpenSLAM.org. This website is a gold mine for SLAM algorithms and their implementations. You can learn a lot from there.

The algorithm from the paper, "Improved Techniques in grid mapping with Rao Blackwellized particle filters" is implemented as gmapping (or slam gmapping) and it does precisely what you want. The source code can be found on github.

Hope this helps.

• Welcome to Robotics HarshSinha. Thanks for your answer but we prefer answers to be self contained where possible. Links tend to rot so answers which rely on a link can be rendered useless if the linked to content disappears. If you add more context from the link, it is more likely that people will find your answer useful. If you link to a paper, please post the title and author(s) of the paper.
– Chuck
Jul 20, 2017 at 13:35

1- A occupancy grid map is simply a 2D array

2- if you have a map and you just want to locate the robot/vehicle you can use a particle filter, it is easy and efficient

3- it seems you want to SLAM, so you can use an algorithm called grid based fastslam 2.0, it uses particle filters and grid maps, you can find on this site some explanations of fastslam

a- in summary, you use a particle filter to localize the robot, this is done by using the motion model and scan matching

b- then you map your lidar scan

c- then you resample your particle

PS: each particle saves a full map with it