introlab / rtabmap

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

Tango app crashes with memory used over 1300 MB #82

Open matlabbe opened 8 years ago

matlabbe commented 8 years ago

From comment on Tango app page:

matlabbe commented 8 years ago

Because of slow SD-Card access, the database is kept in RAM instead of hard drive unlike on the Desktop version. Indeed, the app may crash if the RAM is full.

For post-processing with more options and faster exporting to *.obj, save the database and open it in Desktop version:

Open Database Edit -> Download all clouds (update cache) File -> Export 3D clouds... The Bundle Adjustment option is very new, so there are probably some improvements to code that can be done.

matlabbe commented 8 years ago

I reproduced the problem on Tango:

  1. Open RTAB-Map's app on Google's Project Tango (tablet used here).
  2. Click on Rendering Options..., then on Debug to show debug overlay.
  3. Map until Memory used in Debug view is around 1400MB (~600 nodes in Working Memory, total length of the trajectory is ~400 meters). A message "Tango disconnected!" will appear. The mapping is not working anymore. However I was able to save the database, hopefully! The resulting database is 103 MB and can be opened in Desktop version: 160518144439145

Looking at the idle memory used by the device, there is normally 2.6GB RAM free: screenshot_2016-05-18-14-29-09

I'm not sure about if android apps have access to whole free memory or not. I'm using Debug. getNativeHeapAllocatedSize() to get the memory usage. A more in deep analyse may be done to see how much memory is available for the app. We could warn the user that RAM limit is almost reached.

On other side, optimizations could be done to reduce the RAM memory used. For example, all point clouds are still kept in cache even if some nodes are transferred in LTM. Caching was used to avoid reconstructing the point clouds when bringing back to WM, thus saving computation time. Being able to change the memory threshold could also limit the number of nodes in WM.

greymfm commented 7 years ago

I'm trying to localize a robotic mower in an larger outdoor environment (30x30m) and experiencing the same (memory overflow). Actually, I don't need an accurate map (30cm grid size would be fine too). Do you think you could add some options for the next release that allows us to reduce memory? It will be also a great localization app, even with lower resolution :-)

matlabbe commented 7 years ago

Are you referring to Tango App? or rtabmap_ros?

greymfm commented 7 years ago

Tango App

matlabbe commented 7 years ago

You can set already a voxel size of 20 cm with the current app when exporting the point cloud. I can indeed add more options if needed (e.g., 0.3, 0.4, 0.5 m). See "Voxel Size" in Exporting... options: screenshot_20170210-154756

For the online rendering while you are scanning, you can reduce the memory used by showing only the point cloud (without mesh and texture) and reducing the point cloud density: screenshot_20170210-154830