Re: Database malformed

Posted by matlabbe on
URL: http://official-rtab-map-forum.206.s1.nabble.com/Database-malformed-tp10500p10513.html

Hi Pierre,

I have good news, I was able to get most data (I think). I followed the instructions of this post, that I copy here. Assuming "rtabmap.db" is the file name of the corrupted database.

1. Dump SQL
sqlite3 rtabmap.db
.mode insert
.output dump_all.sql
.dump
.exit

2. Extract all data without transactions:
cat dump_all.sql | grep -v TRANSACTION | grep -v ROLLBACK | grep -v COMMIT > dump_all_notrans.sql

3. Re-create a RTAB-Map database:
sqlite3 rtabmap_data.db ".read dump_all_notrans.sql"

4. At this step, you could already browse data in that database with rtabmap-databaseViewer. It may be not needed in your case as visual features (Kp/MaxFeatures=-1) are disabled, but for others who need a working database for a robot, you should be able at this point to re-use rtabmap-recovery to fix the database:
rtabmap-recovery rtabmap_data.db

For info, here what I could recover:
rtabmap-info rtabmap_data.db
Info:

Path:               data.db
Version:            0.21.6
Sessions:           1
Total odometry length:748.832764 m
Total time:         2428.857190s
LTM:                5911 nodes and 0 words (dim=0 type=8U)
WM:                 308 nodes and 0 words
Global graph:       5911 poses and 15821 links
Optimized graph:    309 poses (x=15821->-165, y=-62->-24, z=2->0)
Maps in graph:      1/1 [0(308)]
Ground truth:       0 poses
GPS:                0 poses
Links:
  Neighbor:         4954	(length avg: 0.15m, std: 0.15m, max: 1.43m)
  GlobalClosure:    0	(length avg: 0.00m, std: 0.00m, max: 0.00m)
  LocalSpaceClosure:0	(length avg: 0.00m, std: 0.00m, max: 0.00m)
  LocalTimeClosure: 0	(length avg: 0.00m, std: 0.00m, max: 0.00m)
  UserClosure:      0	(length avg: 0.00m, std: 0.00m, max: 0.00m)
  VirtualClosure:   0	(length avg: 0.00m, std: 0.00m, max: 0.00m)
  NeighborMerged:   0	(length avg: 0.00m, std: 0.00m, max: 0.00m)
  PosePrior:        0	(length avg: 0.00m, std: 0.00m, max: 0.00m)
  Landmark:         2	(length avg: 1.58m, std: 0.28m, max: 1.78m)
  Gravity:          5911	(length avg: 0.00m, std: 0.00m, max: 0.00m)

Database size:      5078 MB
Nodes size:         1 MB	(0.02%)
Links size:         5 MB	(0.11%)
RGB Images size:    4242 MB	(83.55%)
Depth Images size:  796 MB	(15.68%)
Calibrations size:  969 KB	(0.02%)
Grids size:         70 KB	(0.00%)
Scans size:         9 MB	(0.19%)
User data size:     0 Bytes	(0.00%)
Dictionary size:    0 Bytes	(0.00%)
Features size:      0 Bytes	(0.00%)
Statistics size:    6 MB	(0.12%)
Other (indexing, unused):15 MB	(0.31%)

cheers,
Mathieu