Question regarding RTAB-Map database?

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

Question regarding RTAB-Map database?

rtab_user
Hello Mathieu,

I want your advice regarding the storage of my database. I want to have a dedicated script for mapping for e.g: map.launch  and every time i run it, I want the database to be saved without replacing the existing database. For example if for first session the database saved is rtabmap.db for other consecutive session i want the databases to be rtabmap1.db, rtabmap2.db and so on.
I learned about rosservice call /rtabmap/backup it saves database inside ~/.ros/rtabmap.db.back but i have to write in terminal everytime. I want to automate this process and need some advice from you.

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Question regarding RTAB-Map database?

matlabbe
Administrator
Hi,

rtabmap node has "database_path" parameter. By default it is "~/.ros/rtabmap.db" but can be anywhere with any name. See this post for example (and follow the other referred link to do it inside a launch file): https://github.com/introlab/rtabmap_ros/issues/336#issuecomment-520057142
Reply | Threaded
Open this post in threaded view
|

Re: Question regarding RTAB-Map database?

rtab_user
Thank you!
I followed your answer and the referred link and was able to successfully save the database. I used
<param name="database_path"       command="bash -c 'printf &quot;rtabmap_%(%d-%m-%Y_%Ih%Mm%S)T.db&quot;'" /> 
on my launch file during mapping process and now i have databases name in rtabmap_17-03-2022_08h36m23.db, rtabmap_18-03-2022_08h41m23.db, rtabmap_18-03-2022_08h43m08.db and so on.
Now in another launch file say run.launch i want to load the database. I just want the latest database to be loaded. How do i set the database path so it always gets the latest db file ? without renaming the previously saved database. For example say rtabmap_18-03-2022_08h43m08.db in the database path.
I want to do so because to keep on using two different scripts for mapping and navigation without losing any database or worry of replacing it.
Reply | Threaded
Open this post in threaded view
|

Re: Question regarding RTAB-Map database?

matlabbe
Administrator

You are looking to find the most recent file in a directory. You may need a bash script or a python script to launch the launch file with the latest database path. You can find on google how getting the last modified file in a directory in bash or python.