Ask Your Question

Octomap volume estimation

asked 2014-04-05 18:10:03 -0500

metal gravatar image

updated 2014-04-07 22:31:23 -0500

AHornung gravatar image

Hello Everyone, I am trying to calculate the volume of octomap generated in octomap_server. Also I only want to calculate the volume containing occupied voxels(not the empty ones). Also some voxels overlap each other. So any thoughts on calculate the the volume?. Thank you.

edit retag flag offensive close merge delete


Don't change your question and replace it with a completely different one! Leave your questions for future reference and post a new one if it's not an addition or clarification on your original question.

AHornung gravatar image AHornung  ( 2014-04-07 22:30:26 -0500 )edit

Sorry about that. I have re-posted the new question, here Please share your thoughts on that. Thank you.

metal gravatar image metal  ( 2014-04-08 18:21:11 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-04-06 23:12:47 -0500

AHornung gravatar image

That's quite easy if I understand it correctly and you want to compute the volume occupied by all occupied voxels. Just use a leaf_iterator in OctoMap to iterate over all leaf nodes. Then check whether the node is occupied (tree.isNodeOccupied(*it)), get the side length of the current voxel (it.getSize()) and compute the volume from it.

I'm not sure what you mean with "some voxels overlap". Leaf nodes in the octree cannot overlap.

edit flag offensive delete link more


Hello, Octomap_server already publishes occupied voxels as a marker topic. Subscribing to those and reading the scale of each voxel will help calculate the volume?. Please let me know. Thank you.

metal gravatar image metal  ( 2014-04-07 05:18:22 -0500 )edit

That should also work, although working on the octomap directly will be more efficient.

AHornung gravatar image AHornung  ( 2014-04-07 05:44:47 -0500 )edit

I agree, I want to work on the octomap directly too. Is there a way to subscribe to the topic "occupied_cells_vis_array" given by octomap_server. Then convert it to tree to iterate through the leaves.

metal gravatar image metal  ( 2014-04-07 06:52:12 -0500 )edit

Don't use the topic "occupied_cells_vis_array" unless you need a basic visualization, it's inefficient. Check the documentation of octomap_server, it is publishing the map as octomap_msgs::Octomap. You can deserialize the message with the conversion header in the octomap_msgs package.

AHornung gravatar image AHornung  ( 2014-04-07 22:17:39 -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


Asked: 2014-04-05 18:10:03 -0500

Seen: 1,089 times

Last updated: Apr 07 '14