Hi,
I think the easiest way is to derive nearby obstacles from the occupancy grid. Other approach could be to subscribe to /rtabmap/cloud_obstacles topic, which is a PointCloud2 type. The disadvantage is that dynamic obstacles or noisy obstacles will all appear in /rtabmap/cloud_obstacles, as there is no overwriting from empty cells like in occupancy grid (e.g., when we remap the same area but with an obstacle removed).
You can map first the environment, then switch in localization mode (Mem/IncrementalMemory=false).
For dealing with dynamic moving obstacles (like people, pets), I suggest to use the
obstacle layer of the local costmap and/or global costmap instead of updating the static map published by rtabmap.
For dealing with "slowly" dynamic obstacles (like furnitures moved over time), it would be possible to start rtabmap again in mapping mode with the previous map, find a loop closure to merge the new map and the old one, move around to add/clear spaces where objects have moved, then go back after that in localization mode.
cheers,
Mathieu