Localize multiple robots with a single map database

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Localize multiple robots with a single map database

aamirhatim
As the title says, I would like to use a single map database to localize multiple robots via ROS. Here is my setup:

- Four identical mobile robots, each with a stereo camera mounted in the same place
- An existing map built with rtabmap_ros using one of the robots
- A remote machine running rosmaster

Assuming all networking between machines is handled, is there a way that I can serve the map database on the remote machine and have each robot use it to localize itself within the map? I am trying not to load the database on each robot.

Thank you!
Reply | Threaded
Open this post in threaded view
|

Re: Localize multiple robots with a single map database

matlabbe
Administrator
Hi,

Maybe not exactly what you want, but it is possible to launch many rtabmap nodes in localization mode with the same database (see this example https://github.com/introlab/rtabmap_ros/blob/master/launch/tests/test_two_kinects_one_map.launch). In your setup, the 4 rtabmap would have to be started on your ros master in different namespaces as rtabmap needs to load a local database file.

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: Localize multiple robots with a single map database

ekuruvilla
Hello Mathieu,

When the same database is shared among multiple rtabmaps, is there any risk of more than one rtabmap simultaneously modifying the database and corrupting it?

Thanks,
Eapen
Reply | Threaded
Open this post in threaded view
|

Re: Localize multiple robots with a single map database

aamirhatim
I ended up running the setup that Mathieu described earlier and did not run into any corruption issues but the instances were all in localization mode. I will mention though that it seemed like moving the database file to a different location resulted in some kind of corruption and I would need to build a new db. This is more anecdotal however and I wasn't able to do more targeted testing on this.

Btw, thank you Mathieu for the suggestion - it worked well for my use case :)
Reply | Threaded
Open this post in threaded view
|

Re: Localize multiple robots with a single map database

ekuruvilla
Thank you aamirhatim for the confirmation that this approach works.  I see that corelib/src/DBDriver.cpp uses MUTEX when accessing the database and thereby making the databases changes thread safe.