Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With MM enabled, WM is not decreasing when Mem/ReduceGraph=true and following specific conditions #1337

Open
matlabbe opened this issue Sep 7, 2024 · 0 comments
Labels

Comments

@matlabbe
Copy link
Member

matlabbe commented Sep 7, 2024

MM -> Memory Management

Conditions:

  • MM is enabled with Rtabmap/TimeThr or Rtabmap/MemoryThr
  • Mem/ReduceGraph is enabled
  • The camera/robot always revisiting the past locations with loop closures detected (so that Link::kNeighborMerged are replacing Link::kNeighbor when exiting STM to WM)

Following these conditions, all nodes in the map get immunized following this code because they could all fall under Bayes/PredictionLC size:

//immunized locations in the neighborhood from being transferred
if(immunizedLocations.insert(iter->first).second)
{
++immunizedGlobally;
}

Without Mem/ReduceGraph, the maximum nodes immunized at this step would be Bayes/PredictionLC size x 2 (or 34 nodes with default value), then maximum immunized nodes would be 34 or RGBD/LocalImmunizationRatio (of whatever WM size is). However, when there are Link::kNeighborMerged links, that number can be higher because of this condition where indirectly loop closures are not ignored:

rtabmap/corelib/src/Memory.cpp

Lines 1544 to 1573 in 11a8057

if(iter->second.type() == Link::kNeighbor ||
iter->second.type() == Link::kNeighborMerged)
{
if(ignoreIntermediateNodes && s->getWeight()==-1)
{
// stay on the same margin
if(currentMargin.insert(iter->first).second)
{
curentMarginList.push_back(iter->first);
}
}
else
{
nextMargin.insert(iter->first);
}
}
else if(!ignoreLoopIds && (!ignoreLocalSpaceLoopIds || iter->second.type()!=Link::kLocalSpaceClosure))
{
if(incrementMarginOnLoop)
{
nextMargin.insert(iter->first);
}
else
{
if(currentMargin.insert(iter->first).second)
{
curentMarginList.push_back(iter->first);
}
}
}

Removing iter->second.type() == Link::kNeighborMerged there could be a solution though I am currently not entirely sure if it would work as expected in all cases. For example, assuming we have the graph state as below and we want to retrieve around Node 42 (blue links are Link::kNeighbor type and orange links are Link::kNeighborMerged type). If we remove that condition, it means we won't be able to immunize all red nodes (that are all actual neighbors of 42) because they are indirectly linked by a Link::kNeighborMerged link, but we want them immunized so that Bayes filter continues to retrieve appropriate nodes from LTM (and to correctly estimate loop closure hypotheses).
image

With that figure, we can also see the current issue where neighbors of node 18 (including 3 and its neighbors) would be also immunized following the current condition. The question is how do we immunize red nodes without immunizing neighbors of 18 and below?

@matlabbe matlabbe changed the title With MM enabled, WM is not decreasing when Mem/ReduceGraph=true AND always revisiting same locations under Bayes/PredictionLC size With MM enabled, WM is not decreasing when Mem/ReduceGraph=true and following specific conditions Sep 7, 2024
@matlabbe matlabbe added the bug label Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant