Does octomap calcNumNodes() give total number of occupied+free voxels?

asked 2019-08-18 09:24:09 -0500

usamamaq gravatar image

updated 2019-08-23 07:56:57 -0500

Hello i am working with ros octomap library. Octomap function calcNumNodes() returns with size. Function is defined like this:

octomap::OcTreeBaseImpl< NODE, I >::calcNumNodes() const

Traverses the tree to calculate the total number of nodes.

Does it mean this return total number of occupied + free voxels?

Actually i want to find how many voxels has been explored in a cubic volume and i am using this function but from the numbers i feel like its much lesser than how many there should be.

For an alternate there can be a way that i iterate all over the occupied and free voxels and count them, but should i be doing that or not? Pls enlighten me if there is better alternate?

P.S. I tried searching about this but couldn't find a clear answer. If there is an explanation somewhere i will be happy to read that as well.

Thanks.

edit retag flag offensive close merge delete

Comments

So up till now what i have underatood is that everytime updatenode() is done with occupied or free cells it prune the voxels having same status into one node. So calcNumNodes() will not tell number of occupied+free cells at given resolution but total initiated nodes either free or occupied. So i am using expand() first to divide all nodes at given resolution and then calcNumNodes().

Still open for suggestion from community if anyone has any.

usamamaq gravatar imageusamamaq ( 2019-08-23 11:52:43 -0500 )edit