Re: rtabmap-reprocess tool

Posted by matlabbe on
URL: http://official-rtab-map-forum.206.s1.nabble.com/rtabmap-reprocess-tool-tp7438p7448.html

Hi Alice,

To make sure I understand, each robot does a first session, then the resulting maps are merged:
rtabmap-reprocess "input1.db;input2.db;input3.db" "output_first_sessions.db" 

Then each robot starts again from their original map (input1.db, input2.db, input3.db), create a second session in them. The following will merge input1.db's sessions 1 and 2, then input2.db's sessions 1 and 2, then input3.db's sessions 1 and 2:
rtabmap-reprocess "input1.db;input2.db;input3.db" "output_all_sessions.db" 

To merge only second sessions together, we would have to do extract each second session before merging them:
# get first id of the second session (session ids start with 0) 
$ sqlite3 input1.db "select min(id) from Node where map_id=1"
28
$ rtabmap-reprocess -start 28 input1.db "output1.db" 

$ sqlite3 input2.db "select min(id) from Node where map_id=1"
37
$ rtabmap-reprocess -start 37 input2.db "output2.db" 

$ sqlite3 input3.db "select min(id) from Node where map_id=1"
19
$ rtabmap-reprocess -start 19 input3.db "output3.db" 

# merge all second sessions:
rtabmap-reprocess "output1.db;output2.db;output3.db" "output_second_sessions.db" 

To have more flexibility, if you want to extract only session 4 from a database containing 10 sessions, you could use the -stop # option with last id of the fourth session:
# get first id of session 4:
$ sqlite3 input10sesssions.db "select min(id) from Node where map_id=3"
192
# get last id of session 4:
$ sqlite3 input10sesssions.db "select max(id) from Node where map_id=3"
256

$ rtabmap-reprocess -start 192 -stop 256 input10sesssions.db output.db

With rtabmap-databaseViewer, it is also easy to extract one session from a database with File->Export database, then set session id (starting with 0):

This however only extracts raw data, you would have to reprocess that database to get the map.

cheers,
Mathieu