Posted by
matlabbe on
URL: http://official-rtab-map-forum.206.s1.nabble.com/Integrate-external-markers-from-apriltag-ros-with-Priors-tp10358p10426.html
Hi fboris,
I think I see what you are meaning about the landmarks (when dialing down the memory threshold Rtabmap/MemoryThr to 60 to forget as most nodes as possible). The use of Mem/ReduceGraph=true makes it even more interesting with memory management enabled. Not related your problem, I've found an
issue with WM increasing out of bound with Mem/ReduceGraph=true by doing the trajectory your are doing (revisiting always the same areas).
In your case, the issue is that as soon as a landmark is not linked to local graph anymore, the graph origin will change drastically to latest node in the graph (RGBD/OptimizeFromGraphEnd=true). Here is an example of a sequence happening when nodes are moved back and forth between WM and LTM.
1. Both landmarks are connected to current graph, origin of the graph is then based on `Marker/Priors`
2. One landmark remaining, origin of the graph is still based on `Marker/Priors`
3. Both landmarks are gone, origin is based on odometry of latest node added to graph
4. Retrieved a node linked to local graph with landmark, origin is back on `Marker/Priors`
5. Same than 4, now both landmarks are back
6. Like 3, both landmarks are gone from local graph, origin jumps back to latest node
7. A node with landmark reappear in the local graph, the origin is back on `Marker/Priors`

Another interesting effect is that because the landmarks are on the ground at z=0, if odometry is drifting vertically, as soon as the landmarks are not in local graph anymore, the whole map will jump in z (accordingly to current odometry):

I think the memory management and graph optimization are behaving as expected with the landmarks. The local map looks fine, but the the origin is jumping around. That behavior is observed in this
paper (Figure 11 for example, we see the local graph changing origin over time), but as long as planning goals are "nodes" and not "poses", robot is still able to navigate even if the origin changes.
So for your question:
Is it possible to enforce rtabmap to keep node which saw landmark always inside the working memory to keep landmark constraint?
Currently not. I think what you want is that the origin stays the same (in landmarks origin) even if nodes that observed the landmarks have been transfered in LTM. I don't think immunizing all nodes up to landmarks (to keep them in local graph) is a good solution (that won't scale well). I think the most efficient way would be to keep track of the landmarks and add their constraints in graph optimization (so that with their priors the origin will stay the same). One idea would be to add a "Link::kVirtualClosure" link to oldest node in the local graph (and updating that link when the oldest node attached to is transferred, then change it again to new oldest node in local graph). That could keep the graph from drastically jumping around. I say "keeping it linked to oldest node in local graph" instead of "newest node in local graph" in order to limit origin drifting overtime if the landmarks are not re-observed for a while. I created an
issue to implement that feature. Let me know if I missed something!
cheers,
Mathieu