I am using rtabmap in ROS and I was wondering whether it is possible to change the original/internal point cloud which is constructed by rtabmap. More specifically, I want to filter out some unwanted points in the map. To do this, I keep a list of areas which need to be filtered out. The reason I need to do the filtering is because I am having other mobile robots in my environment, which pollute my point cloud with points which are only there very momentarily.
As I understand it, ROS doesn't use shared memory for the ROS messages, so accessing the original point cloud seems impossible. And even if shared memory was used, I checked the code of fromROSMessage() here, and it seems that a copy of the point cloud is made, preventing to make permanent changes to the original point cloud from rtabmap anyway. One possible solution for me would be to use ExtractIndices from pcl every time again when I receive the point cloud from rtabmap, but that would be very inefficient as the list of to be filtered area's grows really long over time. So now I was wondering whether there is any way to filter out those points once and for all, so they wouldn't be present in the point cloud I receive in the next callback from rtabmap (similar of how the ground plane is filtered out in some published topics - but in a more generic way so I can define which points are filtered).
Is the map constructed from an RGB-D camera? I'll assume that for the following.
Objects can be filtered with different approaches. If you can detect the object to filter in the RGB or depth image, you can mask the depth image before feeding it to rtabmap, so no points will be created on the object.
If its not a problem to manually remove the objects, you can use rtabmap-databaseViewer and edit the depth images to erase the unwanted objects. See the mirror removal step 4 on this tutorial.
Another approach is to use the OctoMap outputs of rtabmap. With the following parameters:
and subscribing to /rtabmap/octomap_**** topics, the dynamic objects can be cleared from the map.