-
Notifications
You must be signed in to change notification settings - Fork 551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Modify grid_map #213
Comments
Hi, The short answer: use the map_server workaround you described as we cannot modify the grid map in the database. The long answer: RTAB-Map doesn't keep the global occupancy grid map saved like this in the database, it keeps all local occupancy grid maps created for each node in the map, then reconstruct the global map on runtime. It is because on loop closure detection, the graph may change so that global map must be reconstructed. In localization mode, the map would be static as there are no map corrections, so the map could be saved as is in the database. However, it is not always the case because of the memory management (when used) that could transfer/retrieve some parts of the map even in localization mode, so that graph optimization should be done again. Well, for the special case of localization without memory management, we could think about saving the global map in database for convenience, instead of manually using the map_saver/map_server approach, to keep all data at the same place. That feature would require at least an export/import approach to get the occupancy grid map in an image editor, then re-save it back to database. The Admin table could be used to save the last optimized occupancy grid with corresponding optimized graph (similar to what is done for the optimized mesh saved by RTAB-Map Tango). If we address the lane preference, how would you edit the map to tell the planner that some cells should be used over others? Currently the cells are 0=empty, -1=unknown and 100=obstacle. While not used by rtabmap, values between 0 and 100 are probabilities of an obstacle, probably using values 101 to 128 and -2 to -128 may encode the lane preferences. Another approach to set lane preference, without the grid map, is to encode the preferences in the nodes of the graph (using label field for example). I already used this on a robot where I had to set zones where the robot could move faster or slower. The topic /rtabmap/mapGraph contains poses of the map with their label, so it is possible to know indirectly the position of the lanes (paths that you drove the robot during the mapping phase). cheers, |
Thanks, I dug through the db hoping to find the grid, but couldn't as per your explanation :). I think trying to modify the map rtabmap serves is not the right way to go as that would be stretching its intended purpose. I'll see how well it would be to integrate the map_saver/map_server approach. It seems there there is a philosophical approach to make rtabmap more of a "live mapper" type system, that maps and handles loop closures while normal robot operation, instead of a dedicate map maker and dedicated map localizer/server. I don't see how this works because if you intend to map while operating, you cannot operate in an environment with dynamic obstacles. As an added bonus, separating those tasks gives you the benefit of allocating precious CPU cycles to the task at hand. |
Current research using rtabmap is about long-term continuous SLAM(see this paper for example): always updating the map while operating, so that the map can adapt to changes in environment and extend during exploration. Indeed, for many practical applications, it is simpler to go through a mapping phase, then switch to a localization phase. Being able to save the global grid map in the database as explained in my previous post would help then help to do this kind of application more easily and efficiently. Cheers, |
Cool, if you did that, I'd also be able to go into the grid map and modify it to take out false obstacle cells where people walked in the front of the robot :) |
I've been working on this more and I have run into an issue with the map that rtab publishes changing over time. My approach is as follows:
This works but only for a few seconds. After that, rtabmap seems to serve a map that is slightly shifted or rotated. It seems like rtabmap isn't just sending a new transform, but modifying the map itself and shifting it to fit the transform. Any advice? Is there maybe a setting I could change that would leave rtab's served map unchanged? Here is a shot of me running rtabmap in localization mode, while serving up my custom map. I am also displaying the /grid_map publishes by rtabmap, which is localized properly, but shifts causing a discrepancy with the custom map i and using in move_base. The rtabmap /grid_map is colored in as a map and the custom map is colored in as a costmap. Thanks! |
If /map -> /odom stays at Identity transform and the map rotates/translates on localization, it looks like that |
That did it!!! Thanks man! I'll do a quick writeup about how I used this solution and post it up here. |
…introlab/rtabmap_ros#220). Parameters: fixed Icp default parameters when not built with libpointmatcher, added RGBD/SavedLocalizationIgnored (default false). DbViewer: added Export/Import 2D map (introlab/rtabmap_ros#213).
…default on localization, rtabmap will adjust the odometry to match the latest saved localization in the database (starting automatically from where the robot shut down, #220).
Using commits above, the grid map is automatically saved to database on exit. We can use DatabaseViewer -> File- > Export saved 2D map... to export the map in pgm image file. That file can be edited using a image editor to remove/add obstacles. Then with File -> Import 2D map, the map can be re-imported and overwriting the one saved in the database. When relaunching the robot in localization mode, the edited map will be used. |
Hey @matlabbe thanks for the update! I just pulled the latest master commits for both rtabmap and rtabmap_ros and gave this a go. I did it using my sim gazebo setup and found that rtabmap was freezing after about a couple of minutes of mapping. By freezing i mean that new nodes were being added and rtabmapviz shoes no new information. I reverted back to the old version I was using and problem went away. Didn't have enough time to dig into it, just wanted to let you know. -Paul |
Thx to let me know, I am however not able to reproduce the problem when wandering a couple of minutes with turtlebot gazebo demo. A freezing without any errors may be related with some input topics not published anymore or that they are badly synchronized (some topics are lagging for example). If it is the GUI which is not responsive, maybe a GPU related problem. Well, if you retry the latest version, get screenshot and the terminal log status. cheers, |
Is there any other solution for ros side only? |
The database should be closed before editing the map, so not sure how we could do that with ROS. Note that the grid map can be edited directly in rtabmap-databaseViewer without having to export/import back the map. See http://official-rtab-map-forum.206.s1.nabble.com/post-processing-manually-add-obstacles-to-map-tp6985p6993.html |
Thanks @matlabbe , we solved it from databaseviewer but we are facing one issue that is except octomap_grid topic others are recreates the map even if we open in localization mode that's why we re trying to import modified octomap_grid map but there is not anything about it , databaseviewer only takes grid_map but in this map our obstacles are very rare compared to octomap_grid. Is there any solution to import changed octomap_grid map, or to stop mapping while opening grid_map with localization? |
We would need to add an option in DatabaseViewer to select which map to edit and save. As a workaround, you could use |
I will try it but do you have an idea about when I open the map for localization with rtabmap/grid_map topic or others (except octomap_grid) it starts to create map again on existing map, how can I stop it ? |
It feels you are not really in localization mode. |
I already set the param false, I will send the db when I am available. |
It didn't work. |
when I run this command I got some erros like: If it will any other things happen, I will write them here. |
The computer you are reprocessing the database doesn't have rtabmap with g2o dependency. TORO optimizer is used as backup but it doesn't support BA optimization. |
Thanks @matlabbe ! |
Hi @matlabbe , can you please summarize steps to modify grid_map. thank you . |
You won't see the changes in Graph View, you can make sure your changes are there by doing File->Edit optimized 2d map..., then you will see the actual optimized/modified occupancy grid that rtabmap will use when relaunching in localization mode. See also http://official-rtab-map-forum.206.s1.nabble.com/post-processing-manually-add-obstacles-to-map-tp6985p6993.html: |
Hi @matlabbe thanks for reply |
Can you try editing the map with the embedded editor (just for a test)? Maybe there is a bug in the ui that makes it not detecting the map has been updated when re-importing the map. |
@matlabbe thanks it working now. |
Hello! I am creating good maps with rtabmap, and am using the grid_map output for planning use. My currently workflow is I first do a mapping run with settings that are good for mapping, then I save the database and run the refinements and more loop closures in rtabmap-database viewer. I then use the database in just localization mode for normal operation of my robot. My question is: Can I modify the grid_map published by rtab?
It would be nice to add in some things into the 2d occupancy map that rtabmap serves up. For example, i'd like to create "lanes" for my robot to travel in, to make it easier for path planning with multiple waypoints. Like this:
Is there an easy way to do this? I was also thinking of maybe creating a separate map that has my stuff on it, and serve it with ros' map server and publish a static tf link to the rtabmap map frame.
Thanks for all your work!
The text was updated successfully, but these errors were encountered: