rtabmap icon indicating copy to clipboard operation
rtabmap copied to clipboard

Obstacles removed from occupancygrid

Open sandeepdutta opened this issue 1 month ago • 11 comments

Hello Mathieu,

Our setup has two depth cameras (one facing forward, the other facing backwards). In mapping mode (Mem/IncrementalMemory = True), some obstacles are removed from the Occupancy grid as the robot moves and turns through the environment, it seems some filter kicks in and removed some obstacles if they are not visible for some poses. Are there any parameters we can tune to change this behavior ? It is more aggressive when "RayTracing" is turned on.

Best Regards Sandeep

sandeepdutta avatar Oct 21 '25 18:10 sandeepdutta

Are there obstacles cleared that should still be there? It should not clear obstacles that are still there, however if the obstacles is moving, it may clear where the objects were when that area is re-observed. The only parameter that would make obstacles not in field of view disappear would be GridGlobal/FootprintRadius (disabled by default), which would clear obstacles under each node in the graph for about that radius.

matlabbe avatar Nov 01 '25 22:11 matlabbe

Hello Mathieu,

I did some more analysis on this, our robot has two cameras one facing forward and the other facing backwards & it turns a little asymmetrically (the drive wheels are not in the center). This problem occurs for low objects (such as low tables) close to the robot. As the Robot turns one camera sees it the other does not and it is removed. If you have any suggestions that would be much appreciated.

Best Regards Sandeep

sandeepdutta avatar Nov 07 '25 18:11 sandeepdutta

If you are using Grid/3D=false, some obstacles can be cleared like that. If you want to make sure that all obstacles that are not seen remain, set Grid/3D to true.

matlabbe avatar Nov 10 '25 06:11 matlabbe

Hello Mathieu,

I tried Grid/3D=true it did not help, it looks like it happens when Grid/RayTracing is true, I need it to be true otherwise the map is very noisy. I will keep investigating.

Best Regards Sandeep

sandeepdutta avatar Nov 13 '25 18:11 sandeepdutta

Depending on the voxel size (Grid/CellSize) and how thin an obstacle is, it could be ray traced even in 3D. If you have a database to share, I could look at it if give some tips if I see an issue.

matlabbe avatar Nov 23 '25 22:11 matlabbe

Hello Mathieu,

I have attached a zip file containing two files a) home_matte_no_3d.db Grid/3D = False & b) home_matte_3c.db Grid/#D = True. I have also attached a picture of the Robot in environments, the databases are created by rotating the robot in pace. Please let me know if you need any more information. The software is built from github HEAD. Any suggestion will be greatly appreciated.

Best Regards Sandeep matte.db.zip

Image

sandeepdutta avatar Nov 30 '25 23:11 sandeepdutta

The db files are empty. You can share also using a public dropbox or google drive link.

matlabbe avatar Dec 02 '25 03:12 matlabbe

Hello Mathieu,

Sorry I should have downloaded and made sure. I have uploaded to a google drive, please let me know Best Regards Sandeep

https://drive.google.com/file/d/1vJLeMFnNS1Nv0xqe4AWwIFE5lUCukFH3/view?usp=sharing https://drive.google.com/drive/folders/1IZRhh8fDtWhEUDGeVm7OV21wNUyq9Jko?usp=sharing

sandeepdutta avatar Dec 02 '25 16:12 sandeepdutta

Which 2D occupancy grid map are you looking at? I replayed the 3D version and I show here the default 2D grid assembled and the one created from the OctoMap (right):

Image

https://github.com/user-attachments/assets/d6788fb8-addc-4ad8-81d5-9f11b4ae2121

https://github.com/user-attachments/assets/97d03571-ce6f-4181-9ad7-a65e53cdae53

On the one with the Octomap, the obstacles don't get cleared as easily. Note that the disparity generated is not super dense, so with slight odometry drift it could clear some thin obstacles.

matlabbe avatar Dec 04 '25 06:12 matlabbe

Hello Mathieu,

Thank you so much for the analysis. I can certainly use the octomap generated occupancy grid. May I ask what tool you are using to regenerate from the database, also what tool are you using to visualize ? I also discovered that if I add the point cloud generated by the cameras as scan_point_cloud, it generates a very good occupancy grid . I turn off the scan_point_cloud during localization to get better performance. Does turning off the scan_point_cloud during localization have any adverse effects ?

Best Regards Sandeep

sandeepdutta avatar Dec 04 '25 16:12 sandeepdutta

If the local grid is computed from the depth image, see Grid/ parameters. These are used to generate the point cloud. Maybe your camera is giving the full dense point cloud without downsampling, which would be more dense than the default parameters Grid/, in particular Grid/DepthDecimation=4:

$ rtabmap --params | grep Grid/

Note that the database I saw had stereo data in it, which would produce very sparse point cloud in that kind of environment. If your camera can provide a denser depth image, you may feed rtabmap with left+depth image instead of stereo data.

You can replay databases like I did with different parameters in rtabmap standalone. First, open the database directly to get the parameters (say yes to use parameters from the database):

rtabmap my_map.db

Then click on "close database", open Preferences, go under "Source" and select database as input source. Scroll down to set the database path to use. If you use the "..." button to get the database path, you may answer yes to next questions.

Do back on main window and hit "Start". By default wit would replay at the same speed than the recording. You can increase the input rate in Preferences->Source at the top (non-zero input rate) and then uncheck "Use database stamps as input rate." in thew database options.

During localization, indeed, you don't need the point cloud, unless you want to do some ICP based registration. However with RGB-D cameras, unless the point clouds are "lidar-acccurate", so in your case (stereo camera) I don't recommend to use ICP.

matlabbe avatar Dec 07 '25 19:12 matlabbe

Hello Mathieu,

Thank you so much for your suggestions ,decreasing the depth decimation helped a lot. I tried using Left + Depth, the localization I find is slightly better with stereo , with Left + Depth there is a slight odometry drift. Now I do have a clean map and the obstacles do not get removed.

Best Regards Sandeep

sandeepdutta avatar Dec 13 '25 17:12 sandeepdutta