Ask Your Question
2

read data from octomap_full/octomap_binary

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

knightd23 gravatar image

Hi,

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
0

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

Stats

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

Seen: 257 times

Last updated: Apr 01