Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Initializing and manipulating OctoMaps with more than just occupancy

Hi, Sorry if this is too much of a C++ question, but I'm having trouble understanding how to initialize and update an octree in which the nodes can store a data value.

There is a nice example online showing how to make an octree such as

OcTree tree (0.1); //0.1 is the spatial resolution in m.

and then setting the occupancy of the nodes to true, using


Where point_in_3d is an octomath::Vector3.

So far so good. However, reading the documentation, I've come across an

octomap::OcTreeDataNode< T >

that I'd much rather use. With a data container of arbitrary type T in every leaf, I could presumably store additional information about the geometry there, such as the estimated surface normal, or color, or measurement uncertainty, etc.

What I'd like to know (and haven't been able to understand from the docs) is, how to create such an octree (suppose we want T to be a 3-element vector of type float), and how to update the data.

The reason I'm not using pcl octrees is because octomap provides a way of doing ray casting into the tree, and also because of octovis (neat!).