Skip to content

Maps optimization and merging (MySQL backend)

vsu91 edited this page Nov 15, 2013 · 4 revisions

This page shows how to optimize and merge maps using MySQL as database.

Database setup

First install MySQL server. On Ubuntu it can be done with the following command

sudo apt-get install mysql-server

Log into mysql with root user and create mapping user and mapping database

mysql -u root -p
CREATE USER 'mapping'@'localhost' IDENTIFIED BY 'mapping';
GRANT ALL PRIVILEGES ON mapping.* TO 'mapping'@'localhost';
CREATE DATABASE mapping;

Create structure of the database

roscd rm_multi_mapper_db
mysql -u mapping -p mapping < schema.sql

Load datasets and extract them into the rm_multi_mapper_db package folder. https://drive.google.com/file/d/0B5vpERwJboKFb3poZXNCV0RGZGc/edit?usp=sharing https://drive.google.com/file/d/0B5vpERwJboKFaEZoUHRUM21sWk0/edit?usp=sharing

Loading datasets

Load datasets into the database

bin/load_map_db loop0
bin/load_map_db loop1

When loading the map a robot_id that is used to identify the map is returned.

Visualizing maps

To visualize maps first launch rviz

rosrun rviz rviz -d ../multi_robot.rviz

and run

bin/show_map_db map_id

where map_id is the corresponding map id.

Merging maps

For map merging run

bin/merge_maps_db map1_id map2_id

Optimizing map

For optimization run in separate terminals

bin/worker_g2o w1
bin/worker_g2o w2
bin/master_g2o map_id w1 w2

where w1, w2 are worker node names and map_id is id of the map to be optimized.