ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
This will give the sum of the volumes of free and occupied spaces. If you want to separate the occupied and free space volume, the following code will help you.
for(OcTree::leaf_iterator it = octree->begin_leafs(), end=octree->end_leafs(); it!= end; ++it){
double side_length = it.getSize();
if (octree->isNodeOccupied(*it)){ // occupied leaf node
vol_occ += pow(side_length,3);
}
else { // free leaf node
vol_free += pow(side_length,3);
}
}