Posted by
matlabbe on
URL: http://official-rtab-map-forum.206.s1.nabble.com/Transformations-between-Maps-tp1126p1256.html
Hi,
If the graph is optimized from a node of map 1, then nodes from map 2 will not be in the global map, and vice-versa. If you want to show both maps at the same time (with an offset), you may want to add a fake link (e.g., with 50 meters offset on x) between a node from map 1 and a node from map2.
Adding a link with python following the database schema for
Link table:
# Transformation Matrix (3x4): [r11 r12 r13 o1; r21 r22 r23 o2; r31 r32 r33 o3]
# Set high variance 9999
# Add link between 1 of map 1 and 77 of map 2
# Type of the link is "user link"=4
t = [ 1, 0, 0, 50, 0, 1, 0, 0, 0, 0, 1, 0]
hexStr = ''.join(float_hex4(x) for x in t)
call(["sqlite3", database_path, 'insert into Link (from_id, to_id, type, rot_variance, trans_variance, transform) values(1, 77, 4, 9999, 9999, X\'' + hexStr + '\';'])
# inverse
t = [ 1, 0, 0, -50, 0, 1, 0, 0, 0, 0, 1, 0]
hexStr = ''.join(float_hex4(x) for x in t)
call(["sqlite3", database_path, 'insert into Link (from_id, to_id, type, rot_variance, trans_variance, transform) values(77, 1, 4, 9999, 9999, X\'' + hexStr + '\';'])
To remove a link, you can do that with the database viewer or using sqlite3 as well:
$ sqlite3 "database_path" "DELETE FROM Link WHERE from_id=1 and to_id=77"
$ sqlite3 "database_path" "DELETE FROM Link WHERE from_id=77 and to_id=1"
In database viewer under Graph view, we can set the root of the graph so that corresponding map will be optimized.
cheers,
Mathieu