ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Why is HierarchicalArray2D used in openslam_gmapping?

asked 2016-01-12 08:12:26 -0500

chenkan gravatar image

updated 2016-01-14 23:23:13 -0500

openslam_gmapping uses HierarchicalArrary2D to store the map. HierarchicalArray2D is something like a 2D array, and each cell of it is a 2D array again.

So if a map's size is 256 * 256, size of HierarchicalArray2D is 8 * 8, and each cell of it is a 32 * 32 2D array.

I'm a bit confused about the data structure above, why don't we use an Array2D directly? Does HierarchicalArray2D has any advantages?

Thanks a lot!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-01-15 01:34:31 -0500

I'm no gmapping developer, but there are two advantages to the approach that immediately come to mind:

  • When resizing (especially extending) the map, already existing submaps do not have to be touched. For a continuous map, this would be different and generally requires a complete map rewrite.
  • Spatially neighboring cells are close to each other in memory. This can be advantageous due to fewer cache misses when accessing the map.
edit flag offensive delete link more



chenkan gravatar image chenkan  ( 2016-01-19 22:34:24 -0500 )edit

Question Tools

1 follower


Asked: 2016-01-12 08:12:26 -0500

Seen: 153 times

Last updated: Jan 15 '16