ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

read data from octomap_full/octomap_binary

asked 2015-09-03 08:34:18 -0500

knightd23 gravatar image


I would like to know in octomap, how I can read the data from the topics /octomap_full and /octomap_binary? I tried to use the functions fullmap2msg and binarymap2msg and I couldn't have any result. What I need to do?

Best Regards, Knightd23

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-04-01 05:14:02 -0500

mohamed ahmed gravatar image

updated 2021-04-01 15:12:36 -0500

jayess gravatar image

You can use octomap_msgs/conversions.h just include this file and then you can use all the fuctions for example:

octomap_msgs::binaryMsgToMap(), to get the map from the octomap_binary, then you can iterate on the leafs of the tree as follows:

for (octomap::OcTree::leaf_iterator it = map->begin_leafs(); it != map->end_leafs(); ++it) 

  std::cout<< "Node center: " << it.getCoordinate();

  std::cout<< " value: " << it->getValue()<< "\n";

check this slide could be helpfull

edit flag offensive delete link more

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


Asked: 2015-09-03 08:34:18 -0500

Seen: 398 times

Last updated: Apr 01 '21