SteveMacenski / slam_toolbox

Slam Toolbox for lifelong mapping and localization in potentially massive maps with ROS
GNU Lesser General Public License v2.1
1.68k stars 525 forks source link

Load external prior map #572

Open max0619 opened 1 year ago

max0619 commented 1 year ago

Feature description

I am wondering whether there exists an option to load an external prior map. As far as I can see there exists only an option to serialize a map which was previously slamed with slam toolbox. At the moment, only these serialized maps with this specific format could be loaded as a prior. The problem is that these formats cannot be manipulated externally because they are only available as an archive.

Implementation considerations

An option would be to provide an interface for files which are stored as an occupancy grid (e.g. like nav_msgs/OccupancyGrid) and load them as the Datamap into the Dataset. However, I don't know what is best practice or what potential drawbacks might occur.

SteveMacenski commented 1 year ago

You can serialize that map file and then deserialize it for later use (e.g. your prior map). That still requires that the prior is generated through SLAM Toolbox, but is something you can do today.

The problem is that these formats cannot be manipulated externally because they are only available as an archive.

You may actually do such a thing. The map merging tool is mostly a demonstration of that fact. You can load that serialized file and do whatever manipulation you'd like to it! You have the full, raw data at your finger tips. Then serialize back to file for later use.

There is no support for something like an Occ Grid because an Occ Grid is not a graph, which is what this uses for representing the data and structure of the scene. The output is an Occ Grid because that's a common representation of that information for downstream users - but it is actually not used anywhere internally. Every time a grid is to be published, we actually have to generate that on the fly from the current graph and data because its not a native structure.