Comments (10)
It's not implemented right now, the nodes have no information about their direct neighbors. What you can do is get the node's key (from iterator), then search for that key +/-1 in each dimension.
from octomap.
Hi Armin,
thanks for answering! If I understood your correctly, you mean the following steps:
- find a node by key
- get its coordinates (x,y,z)
- calculate neighbouring 8 coordinates
- search the nodes for every of the generated coordinates.
However, I would prefer to use references to parent nodes. I extended the createChild(int) method in the OcTreeNode
class and if you like, you can accept the merge request from my fork.
By the way! This is a superior framework! Works on windows and linux. (even gs 4.7 :) )
Thank you very much!
from octomap.
The straighforward way would be:
- find a node by key (from coordinates or iterator)
- add / subtract 1 from the key values to driectly get the neighbor key
- search neighbor node by key
See my comments in your pull request for the parent pointers.
from octomap.
An alternative way would be to temporarily store parent information in a recursive call while the tree is traversed, and use that for faster neighbor queries. Some experimental work in that direction was started in the OcTreeLUT classes (unfinished / unused right now).
from octomap.
Oh thank you!
the 3 steps sound promising. Is there a short explanation of how the key is generated? In which direction do I traverse the nodes if I add 1 or subtract 1?
Edit: Sorry for the last message. I found this paper, which is referenced by the OcTreeLUT : http://www.cs.umd.edu/~hjs/pubs/SameCG89.pdf
Great stuff! :)
from octomap.
Have a look at coordToKey, the keys are a simple discretization of the coordinates. So +1 on the first dimension will be +res in x.
from octomap.
Does this also apply to keys of nodes in coarser resolution? Is +1 still +res (getResolution()) or +res in this depth of the tree?
from octomap.
Keys only represent the coordinates at the tree resolution (voxel coordinates). With a depth and the function computeIndexKey(..)
you can get a coarser key, but need to consider the depth yourself (e.g. add +2 at depth 15, +4 at 14 and so on).
from octomap.
I am facing similar issue. I am feeding Octomap::PointCloud. by using iterator I found the octreeNode of each occupied node. But How to find keys of each occupied node from OctreeNode ?
I want to find the neighbours of each occupied node.
from octomap.
Once upon a time there was OcTreeLUT that implemented a lookup table to compute keys of neighbor cells directly.
from octomap.
Related Issues (20)
- How to enlarge the scale of octomap?
- Map Dynamic Casting fails
- octovis library linking
- large difference in speed between add pointcloud to octomap and remove it from the octomap
- octomap shows wrong occupancy information when the manipulator moves HOT 1
- What are the requirements for MapCollection / MapNode? HOT 3
- compilation error HOT 1
- How to reder a color voxel map?
- color drop when dereference pointer to octomap::ColorOcTree object
- cmake error during installation HOT 1
- Memory leak in node creation HOT 2
- OcTree update not fully deterministic? HOT 2
- How are the empty and occupied nodes specified? HOT 1
- Get Free Volumes from octree2pointcloud
- Octovis displays EMPTY "Octree Structure" of map from ros2 octomap_saver_node
- Convert .ply(or .las) to .bt file
- Any working example on clearing dynamic object?
- New release after #406 HOT 12
- Build failure on Windows HOT 2
- A problem with the rviz plugin HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from octomap.