MATLAB Answers

Merge two or more occupancy maps

18 views (last 30 days)
Akshay Hiregoudar
Akshay Hiregoudar on 4 Jul 2020
Edited: Sooraj Sunil on 18 Oct 2021 at 0:50
I am trying to build an occupancy map of an environment using MATLAB's Navigation and ROS toolbox along with Gazebo. I have three TurtleBot3 ground robots in three different rooms of the Gazebo environment and I am navigationg them to get the lidar scan data. Now, I would like to build a single map of the environment.
What would be an ideal way to merge all the three occupancy maps into a single map/figure?
  1 Comment
Bram Surewaard
Bram Surewaard on 30 Apr 2021
For a project I would like to achieve the same as you mentioned.
Did you manage to figure out how to do this?

Sign in to comment.

Answers (2)

Remo Pillat
Remo Pillat on 10 May 2021
Hi Akshay & Bram,
If you know the exact poses of the 3 different TurtleBots, you can call the insertRay function on a single occupancyMap (call function for each lidar reading and input pose of respective robot).
A simple example of this "mapping with known poses" problem is shown in this example (this is for a single lidar).
How are you currently building the map? I might be able to give additional suggestions based on the functionality you are currently using.
Thanks, Remo

Sooraj Sunil
Sooraj Sunil on 17 Oct 2021 at 17:19
Edited: Sooraj Sunil on 18 Oct 2021 at 0:50
Hi Akshay & Bram,
If the initial alignment between the robots are known then the merging is very simple:
  • You can use insertRay as Remo suggested
  • Or alternatively you can get the probability matrix of the individual maps using occupancyMatrix Matlab function then, you can go from probability to the log-odd space and then simply add the probabilities to merge them. Finally to reconstruct the occupancy map based on the new probabilities ( convert log-odd to probability) and with the known resolution use occupancyMap function.
However, if don't know the inital alignment you should employ a merging technique to compute the alignment. I wouldn't recommend multirobot_map_merge but if you want a quick solution you can have a look at it. It can be easily implemented in Matlab using this Matlab example.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!