Hi! I'm quite a newbie with rtabmap and ROS, so I really need your help ^^"
I want to do some field tests with 3 robots (they have all the same hardware and software, and they're equipped with a Realsense camera from which they retrieve their position and build their map). Once the rtabmap.launch file is closed (I'm using a variation of it but the functionality is the same) the databases are saved in a defined directory on each robot with a different name as I set: <arg name="database_path" default="/my/path/to/file/rtabmap_'date + %s'.db"/> I want then to merge the databases coming from the 3 robots using rtabmap-reprocess. The first time would be simply: rtabmap-reprocess "input1.db;input2.db;input3.db" "output.db" Then the 3 robots start to move again and continue the mapping (i.e. without --delete_db_on_start). So, second time they stop and I want to merge the maps I would like to do that not by merging the entire database but by starting from the second session initial node (I hope this is clear!). Now, I see that there is a -start # option to start from a specific node ID and my question is: 1. how can I retrieve the last node ID from the session which is previous to the current one? And also: 2. is there a way to utilise the code of rtabmap-reprocess inside a node to do the merging by launching for example a launch file instead of typing it in the command line? I hope I have been clear enough even if I'm a little bit confused in my mind ^^" Hope you can give me an help with this... Thank you Alice |
Administrator
|
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 |
Free forum by Nabble | Edit this page |