ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How use the octomap with a real map (Mapping reality) in Rviz

asked 2018-06-20 19:12:59 -0500

babe1031 gravatar image

Hello, I am a beginner on ros, and I try to work on the turtlebot2, so, I succeeded to use the octomap to create a 3D map with Gazebo on Rviz, but now, I try to do the same thing but I want to mapping a real room and with octomap to see in 3D on Rviz.I try a lot of things like to use this pointcloud_to_laserscan, octomap_server, but it does not work, so I don't know how I do that.

I hope that someone can help me.

Thanks for your help

edit retag flag offensive close merge delete

Comments

Have you tried rtabmap? It also creates a 3D map of the environment. The tutorials for rtabmap are pretty elaborate. Maybe those can help you with octomap also

PratNag gravatar image PratNag  ( 2018-06-21 04:41:00 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-06-22 05:36:15 -0500

dljubic gravatar image

Hello babe1031,

since you haven't mentioned which type of messages are you receiving from the depth sensor, I will cover both of the options.

  • messages of type sensor_msgs::PointCloud2
  • messages of type sensor_msgs::Image

If you have a topic on which point cloud messages are published from the depth sensor, you should just remap octomap_server cloud topic to yours.

<node pkg="octomap_server" type="octomap_server_node" name="octomap_server">
        <remap from="cloud_in" to="<your_point_cloud_topic>"/>  
</node>

However, you should also provide a transform between the map frame and the frame of the point cloud. This is also stated on the octomap_server site:

You need to remap this topic to your sensor data and provide a tf transform between the sensor data and the static map frame.

The thing you need to know about the transform is that it can not be a static one. If you just provide a static transform between the point cloud frame id and the map frame, all of your measurements would integrate in one spot - where you set the static transform to. Therefore, it is important to have an odometry algorithm that would give you more information about the current position of the robot, and then you could publish a transform based on the current position of the robot.

If you just want to check if all the topics are mapped correctly, you could just give it a try with a static publisher to see what I meant in the previous paragraph.

<node pkg="tf" type="static_transform_publisher" name="tf_pub"
          args="0 0 0 0 0 0 1 map camera_color_optical_frame 10"/>

If you are receiving just depth images, luckily, there is depth_image_proc package that enables you to create a point cloud based on a depth image and camera info message.

If you have any further questions, feel free to ask.

edit flag offensive delete link more

Comments

Thanks for your answer, I will try this

babe1031 gravatar image babe1031  ( 2018-06-24 16:48:41 -0500 )edit

I succeed to save a map with gmapping but after when I want to use octomap to create my 3D map, it doesn't work because my occupancy map doesn't recognize my map saver even if we see it on the grid.

babe1031 gravatar image babe1031  ( 2018-06-24 21:18:57 -0500 )edit

Which map saver are you referring to? Why would you need an occupancy map for the 3D map? I am not sure I understand what is the exact pipeline of your work, could you please explain it in more detail? Also, why wouldn't you create occupancy map and at the same time, create an OctoMap?

dljubic gravatar image dljubic  ( 2018-06-25 04:57:19 -0500 )edit

My target is to do a mapping 3D of a room, and now, I succeeded the part to realize an octomap with Gazebo but now I try to do the same thing with the real turtlebot2, and mapping 3D a room but I don't know how do that. I arrive at mapping in 2D with gmapping but after ...

Thanks for your help

babe1031 gravatar image babe1031  ( 2018-06-25 05:37:18 -0500 )edit

Have you tried the pipeline I explained in my answer? While you are running gmapping, you should subscribe to your odometry topic published by gmapping and create a tf_broadcaster based on that information.

dljubic gravatar image dljubic  ( 2018-06-25 14:55:05 -0500 )edit

That's work, I change the point cloud topic like you said hear : <remap from="cloud_in" to="&lt;your_point_cloud_topic&gt;"/>, and now, that's good, thanks.

babe1031 gravatar image babe1031  ( 2018-06-26 19:02:11 -0500 )edit

I am glad I could help! :) Also, please mark the answer as correct if it solved your problem.

dljubic gravatar image dljubic  ( 2018-06-27 02:42:52 -0500 )edit

Question Tools

Stats

Asked: 2018-06-20 19:12:59 -0500

Seen: 873 times

Last updated: Jun 22 '18