Iterating all indices of wavemaps #78
-
Hi and thank you for the extremely interesting library. I have managed to integrate wavemap to my data collection pipeline and I save the created maps to .wvmp files. I would like to compare two created maps collected from the same environment (using the same world coordinate frame). How to iterate all occupied voxels from map1, get the voxel's xyz coordinates and use them to check if the corresponding location of map2 is occupied (or free or unknown). The examples presented for the python / C++ APi are quite minimal and only demonstrate how to get values for single / random set of indices. Perhaps this is a bit noob question, but I think it would be a nice addition to the examples to at least show, how to iterate through all the stored indices of a map. Best Regards, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @PaulKemppi , Thanks for the good question! To do what you described, you could use the map interface's To compare
Note that in some parts of the environment, map_b could have leaf cells at a higher resolution than map_a (especially in areas that changed). However, I hope this helps! Let me know if you have follow-up questions. |
Beta Was this translation helpful? Give feedback.
Hi @PaulKemppi ,
Thanks for the good question! To do what you described, you could use the map interface's
forEachLeaf
method. It takes a lambda function, which it then calls for each leaf node in the map - passing the node's index and value as arguments. We didn't get to add it to the Python API yet, though, so it's currently only available in C++.To compare
map_a
tomap_b
, you couldauto comparator_fn = ...
that capturesaccelerator_b
by reference and expectsnode_index
andnode_value_a
as arguments. In the lambda, it then usesaccelerator_b
to look upnode_value_b
.map_a.forEachLeaf(comparator…