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

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

click to hide/show revision 2
No.2 Revision

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();

it.getCoordinate();

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

}

check this slide could be helpfull