ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org
Ask Your Question
1

How to run Octomap from terminal?

asked 2016-12-02 11:26:44 -0500

Koralgoll gravatar image

I have a problem with proper Octomap setup for indigo. I want to connect it to my published topic but I do not know how should I do so. I can start Octomap server by

roslaunch octomap_server octomap_mapping.launch

Should I assign my point cloud topic directly to the server, or I need to convert it somehow by octomap_ros / octomap_msgs?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-06-16 10:36:07 -0500

dljubic gravatar image

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.

edit flag offensive delete link more

Comments

For consistency, you might want to add --clock to your rosbag play example.

Quizzarex gravatar image Quizzarex  ( 2020-08-26 02:45:48 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-12-02 11:26:44 -0500

Seen: 2,280 times

Last updated: Jun 16 '18