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

Revision history [back]

click to hide/show revision 1
initial version

Hello Koralgoll,

although it is not a difficult question, there are many pitfalls one can encounter in the process of obtaining an Octomap. I hope I will cover some of it in this answer.

If you take a look at the octomap_server site, you can see the list of all subscribed topics. It says that cloud_in is a topic to subscribe to, while also stating the following:

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

Having that in mind, you should also take a look at the launch file you are trying to run. You can see it here.

Notice that frame_id is set to odom_combined and /cloud_in remapped to /narrow_stereo/points_filtered2. Therefore, Octomap will be published in odom_combined frame while subscribing to messages arriving at /narrow_stereo/points_filtered2 topic.

Easiest way to see the Octomap being published is by setting the cloud topic and frame_id inside the launch file! If you installed the Octomap via package manager, the launch file is located in /opt/ros/kinetic/share/octomap_server/launch. I would suggest setting the frame_id to map.

Next, you need to provide a transform between map and frame_id of your point cloud. If you are not sure in which frame_id your point cloud has, you can play the bag, echo the point cloud topic and look at the header part of the message. You need a transform based on the odometry information which you hopefully have in your system, but if you just want to try it with a static transform, you can do the following.

rosrun tf static_transform_publisher x y z yaw pitch roll map <point_cloud_frame_id> 10

That way, your entire map would be built in the same spot. That is why you need to have a transform based on the odometry information, and not just a static transform.

Caveat: there is a difference in obtaining the data in real time and playing it from bag since tf transform takes the ROS time and attaches it to the transform. Therefore, if you are using data from a rosbag file, you should:

  • run the launch file as I said earlier
  • write: rosparam set use_sim_time true in another terminal window
  • play a bag file with the --clock option

If you haven't changed the cloud topic in the launch file, you can just add a remapping to the rosbag play:

rosbag play <your_bag_file> <your_point_cloud_topic>:=/narrow_stereo/points_filtered2

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