Skip to content
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

ROS2, which map topics do rtabmap publish to? #417

Closed
ninamwa opened this issue May 10, 2020 · 6 comments
Closed

ROS2, which map topics do rtabmap publish to? #417

ninamwa opened this issue May 10, 2020 · 6 comments

Comments

@ninamwa
Copy link

ninamwa commented May 10, 2020

Hi.
In the documentation for RTABMAP belonging to ROS1, it says that the rtabmap node publish to the following topics:

grid_map (nav_msgs/OccupancyGrid):
Mapping Occupancy grid generated with laser scans. Use parameters with prefixes map_ and grid_ below.

proj_map (nav_msgs/OccupancyGrid):
Mapping Occupancy grid generated from projection of the 3D point clouds on the ground. Use parameters with prefixes map_, grid_ and proj_ below.

When running the RTABMAP node for ROS2 I can use ros2 node info rtabmap to see that the node publish nav_msgs/OccupancyGrid to two topics: /map and /grid_prob_map.
Are these two topics the same as grid_map and proj_map from the documentation? In that case, which are which?

I am using both a 2D lidar scan and a 3D camera, which means i want to save a 2Dmap using both the laser scan and the projected 3D point clouds. I am using the nav2_map_server to save the map which means i have to subscribe to a topic with nav_msgs/OccupancyGrid messages.

@matlabbe
Copy link
Member

/map is /proj_map. /grid_prob_map is /map but with probabilities (values between 0 and 100) in cells instead of only -1,0 or 100.

/proj_map has been removed because even in ROS1, /proj_map is deprecated and it is the same topic than /grid_map. Well, I just updated the documentation about that.

/map (ROS2) or /grid_map (ROS1) are created from lidar or camera, but not both. In general, if you have a 2D lidar, you would want the map to be created with the lidar. For all 3D obstacles avoidance, that would be done by move_base's local costmap using both lidar and camera.

@ninamwa
Copy link
Author

ninamwa commented May 13, 2020

Hi. Thank you for your answer. I am still a bit confused.
In this tutorial http://wiki.ros.org/rtabmap_ros/Tutorials/SetupOnYourRobot multiple examples combining lasers and a camera is shown. Is this just to make 3D maps?
In our environment, there are multiple overhanging obstacles (grid cells around big robots and machines), and I would like to detect the grids with the cameras, as they are in the wrong height for the lasers (i have two). As far as I can see, RTABMAP only accepts 1 laser topic? If my map only can be made with one laser and nothing else, it would not be a very good map?

Would it be possible to use multiple sessions and continue on the same map, first time using only lidar and next time using only cameras?

@ninamwa ninamwa closed this as completed May 13, 2020
@ninamwa ninamwa reopened this May 13, 2020
@matlabbe
Copy link
Member

In the examples, when the lidar is used, by default Grid/FromDepth is set to false, creating a 2d occupancy grid. The camera is used for loop closure detection.

It is possible to merge two lidar scans into a single fake one, that is then provided to rtabmap. (laser scan to PointCloud2 -> aggregate the clouds -> then convert the combined PointCloud2 back to laser scan).

If you have many sensors from which you want to detect obstacles, you can convert all data to many PointCloud2 and use rtabmap_ros::PointCloudAggregator to merge them into a single PointCloud2 that can be fed to rtabmap (scan_cloud input topic with subscribe_scan_cloud:=true).

Note as I stated previously, the dynamic obstacles or some 3D obstacles don't need to be in the static map, as long as the local costmaps include them when revisiting the area (in which we can combine lidars and cameras easily).

For your last question, yes, you can switch from Grid/FromDepth to false to Grid/FromDepth to true for the second session.

@ninamwa
Copy link
Author

ninamwa commented May 15, 2020

Thank you for a very clarifying answer! I will test the different methods and see which gives the best result! :)

@ninamwa ninamwa closed this as completed May 15, 2020
@ninamwa
Copy link
Author

ninamwa commented May 20, 2020

Hi again. I tried merging my two laserscans by converting them to pointclouds, and then using the pointcloud aggregator to merge the clouds. When visualizing the cloud in Rviz, it looks good, and the 2D grid map created do also look correct, except that no walls are included?
The first image is from using two laserscans merged into a pointcloud (scan_cloud topic), while the second image is from using only one scan (scan topic). An RGBD camera is also used in both cases.
The shape of the map is all correct, but as you can see the black walls saying there is an obstacle disappears. Any ideas?
scancloud
1scan

The reason why i did not convert the pointcloud back into a laser scan as you suggested, is because i want to merge the two laserscans with the pointclouds from my cameras as well. Right now, this do not seem possible as the pointcloud from the camera has a field named rgb, while the pointclouds from the laserscans (transformed by the laserscan to pointcloud node) have a field named index. This causes an error in pcl_conversions.h as the name of the fields are not exact the same:
PCL_ERROR ("[pcl::concatenatePointCloud] Name of field %d in cloud1, %s, does not match name in cloud2, %s\n", i, cloud1.fields[i].name.c_str (), cloud2.fields[i].name.c_str ());

The other fields in the clouds (x,y,z) are similar.
Have you used this method to merge rgbd and laserscan data? What can i do to make the pointclouds similar?

Thankyou!

@matlabbe
Copy link
Member

The clearing of the walls may be caused by the ray tracing. Can you share the database?

You would have to convert all the different point clouds to the most basic ones, i.e., only XYZ channels, before concatenating them. pcl::copyPointCloud can be used to convert to PointXYZ format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants