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

pointclouds2 tf from map frame to sensor frame for octomap

asked 2016-05-05 23:08:12 -0500

torkx gravatar image

updated 2016-05-05 23:29:29 -0500

I am simulating my robot with the kinect in a created world in Gazebo. I can visualize the point clouds and images from RGB and Depth cameras in RVIZ. I want to take those point clouds and create a map using octomap. In order to do it I have to do a tf from map frame to sensor frame. (Octomap Info, check slide 20). I don't know if I should create somehow a tf broadcaster for map frame or create a node that listens to the pointclouds topic and publish to ??? or how to do it. My tf tree starts from base_link and then goes to robot links and camera link.

I have been checking the tf tutorials but don't really understand how to do this. The next step is to call the octomap_server node through the following launch file.


<node pkg="octomap_server" type="octomap_server_node" name="octomap_server">
    <param name="resolution" value="0.05" />

    <!-- fixed map frame (set to 'map' if SLAM or localization running!) default 'odom_combined'-->
    <param name="frame_id" type="string" value="odom_combined" />

    <!-- maximum range to integrate (speedup!) -->
    <param name="sensor_model/max_range" value="5.0" />

    <!-- data source to integrate (PointCloud2) -->
    <remap from="cloud_in" to="/depth_cam/openni/depth/points" />



many thanks.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-05-09 02:09:17 -0500

Che. gravatar image

updated 2016-05-10 07:05:50 -0500

Hi, I've got pretty much the same problem as you. But I think you need to transform from your sensor frame to the map frame, not in the other direction. Because /map is what is getting displayed in the end. Hope we get some help, I did not understand how to use the tutorials in my case too.



Yesterday I got my mapping to work. Here are the steps I took:

I've created a transform publisher, which provides a tf. It describes how to transform from my_moving_frame to my_fixed_frame. As I have variable transformings (my robot is being localized externally) I use the variables for my arguments.

        br.sendTransform((x, y, z), tf.transformations.quaternion_from_euler(0, 0, k),

Then I provided a pointcloud2 with a corresponding node to the topic /narrow_stereo/points_filtered2 like it's configured in the octomap_mapping.launch file.

In the providers for the transform and the pointcloud you need to pay attention to the timing. Use rospy time (0) instead of

Then you fire up your tf-provider, then your pcl2 provider, then you launch octomap_mapping.launch, then rviz rviz and display your map with the octomap-plugins (in the menu of rviz in the top of the application).

Hope this rough description gets you further.

edit flag offensive delete link more


Yeah, conceptually that should be it but I just took the same wording as found in the Octomap documentation. I'm still working on how to create or provide the /odom frame or map/ frame. If I manage to get it working I'll upload my findings.

torkx gravatar image torkx  ( 2016-05-09 09:02:52 -0500 )edit

Hi, have you finished this issue?

Wen Weisong gravatar image Wen Weisong  ( 2017-06-04 05:09:20 -0500 )edit

I am also having trouble with a moving tf frame and octomap_server. I believe it is because pointcloud2 data and tf frame timing are not matching up. octomap_server is continually producing the error: "Could not generate key for origin". I have not found any documentation on this error . . .

Raisintoe gravatar image Raisintoe  ( 2019-01-18 21:48:10 -0500 )edit

Question Tools

1 follower


Asked: 2016-05-05 23:08:12 -0500

Seen: 1,825 times

Last updated: May 10 '16