introlab / rtabmap

RTAB-Map library and standalone application
https://introlab.github.io/rtabmap
Other
2.61k stars 763 forks source link

Manually set status in WM #1157

Open MiuraShuhei opened 7 months ago

MiuraShuhei commented 7 months ago

Is there a way to manually set the status in the WM? Operate in SLAM mode again from the origin on the map already created. I want to put only the nodes near the origin into the WM.

I would appreciate it if you could tell me if there is a better way.

matlabbe commented 7 months ago

Is memory management enabled? If not, all nodes are in WM. Can you describe what issue you are trying to solve?

MiuraShuhei commented 7 months ago

@matlabbe Thank you for your response.

Memory management is enabled.

First, I map in SLAM mode. Next, I start localizing and updating the map from the origin coordinates in SLAM mode. This is because the environment is dynamic. At this time, I want to transfer only the nodes near the origin to WM memory. If InitWMWithAllNodes is enabled, it will take time until the proper number of nodes in WM is reached. If InitWMWithAllNodes is disabled, the last state is retained in WM, so in my case Not appropriate.

matlabbe commented 7 months ago

The natural way to make sure that the origin (or any important location of interest) is staying in WM is to keep the robot still when mapping to build up the weight of the nodes added to map in that area. With high weight, they will stay longer in WM. If rtabmap_viz's loop closure view doesn't change to blue when not moving (indicating weight is increased for current node), maybe Mem/RehearsalSimilarity is too high.

To explicitly force rtabmap to transfer back nodes from LTM to WM on start, we would need to add a new parameter or service to tell rtabmap to load nodes around (inside a fixed radius) a node with specific "label" or "id".

Another hacky way would be to remove the optimized local graph saved in the database before restarting another session to force rtabmap re-creating the local map. Then "touch"/update the time_enter field of the nodes in the database we wish to load in WM. Rtabmap load automatically all nodes in WM from database with time_enter higher than the time_enter set in info table: https://github.com/introlab/rtabmap/blob/a1d43d23533e0846c1dd3d8eb264c54b63112ac9/corelib/src/DBDriverSqlite3.cpp#L3549-L3552