-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce Bonxai as Map representation #22
base: main
Are you sure you want to change the base?
Conversation
find a way to remove unused voxels
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind switching to Bonxai. But did you run some benchmarks? I would expect that it uses much more memory than a simple hash table, as each point would be allocated in a leaf node of 512 voxels, no matter how isolated is this point, which doesn't happen for pain hash tables.
That said I also think it might be slightly slower in terms of runtime. I would probably give it a try with kiss icp, just to try on more datasets, and check the impact on the registration system
And another comment on
It is as much integrated as Tessil and OpenVDB are 🤣 Actually, OpenVDB is more integrated to ROS due to Steve's https://github.com/SteveMacenski/spatio_temporal_voxel_layer, where we went through big pain making sure OpenVDB is it available as an installable package: https://index.ros.org/p/openvdb_vendor/github-SteveMacenski-spatio_temporal_voxel_layer/#jazzy |
We can port it to KISS to test a broader range of datasets. At least on the "Kinematic" sequences, I didn't notice a significant difference in runtime or memory consumption, but as you said, the sample size of our datasets with Kinematic is kind of limited (just 2 sensor configurations). Remember, although we allocate N voxels in the leaf node, each voxel contains a dynamic data structure (a.k.a. PS: In terms of "accuracy" it is literally the same number up to the 4th digit, but I guess this doesn't surprise nobody |
This was an additional motivation for me. The reason I chose Bonxai is not the ROS integration; this is more of a cherry on top. For me, it needs to be easily installable for the C++ API and ROS so that we can keep these two aspects separate. |
Thanks. Please run benchmarks. |
Here there is. For this benchmark, I generate a point cloud out of the surface of a cube with a side of 100m. I randomly sampled 10.000 points for each face, so the total points for the point cloud were 60.000. I then simulate a LiDAR 16x1024 moving inside this "box" and benchmark both the
Note: We could probably further improve the performance of the I will be working on the memory analysis next ;) |
Memory AnalysisFor this experiment, I follow the God commandment and use heaptrack to perform the measurement. I report two different leaf/inner grid sizes, default ( Sampling 6.000.000 points from the surface of a cubeVoxelHashMapBonxaiGrid (default)BonxaiGrid (small leaf)Sampling 60.000 points from the surface of a cubeVoxelHashMapBonxaiGrid (default)BonxaiGrid (small leaf)CommentsWhile using Give me your thoughts guys ;) |
Running the online node on some real data between This is a comparison on Heaptrack, it seems |
To summarize the analysis: At least with the simulated points from the tests, Bonxai is faster for NN query and removing points, whereas the voxel hash map adds points faster. Hard to say how this affects the total runtime because it depends on the actual data rather than the simulated one. I agree we should port this to KISS and run more tests on actual data besides these benchmarks. Regarding memory consumption, I don't know how severe this increase is. Also, it's again not easy to draw conclusions from simulated data because now we sample from a cube, resulting in more dense surfaces compared to a real-world environment. But in general, I also like the results so far, and the time we save on the NN search is the most critical. |
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
# Silence timestamp warning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? I think it's coming from the find_dependencies.cmake
from KISS, we could move it to the top-level .cmake
#include "bonxai/grid_coord.hpp" | ||
|
||
namespace { | ||
static constexpr std::array<Bonxai::CoordT, 27> shifts{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be discussed after resolving PRBonn/kiss-icp#410
})) { | ||
return; | ||
} | ||
voxel_points->reserve(max_points_per_voxel_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There will be duplicated calls to reserve
, but since max_points_per_voxel_
is fixed, this should not matter, right?
std::vector<Eigen::Vector3d> SparseVoxelGrid::Pointcloud() const { | ||
std::vector<Eigen::Vector3d> point_cloud; | ||
point_cloud.reserve(map_.activeCellsCount() * max_points_per_voxel_); | ||
map_.forEachCell([&point_cloud, this](VoxelBlock &block, const auto &) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
map_.forEachCell([&point_cloud, this](VoxelBlock &block, const auto &) { | |
map_.forEachCell([&point_cloud, this](const VoxelBlock &block, const auto &) { |
Motivation
It is finally time to introduce a proper data structure for representing 3D space instead of a simple hash table. By having a more appropriate and flexible data structure, we could extend the system further, for example, by using some TSDF registration or similar. Of course, this should come at a low cost in terms of performance. Our
VoxelHashMap
has done wonders for us in KISS, but I intend to move on.Why Bonxai?
The project is well maintained, does not add additional dependencies, and is header-only. In terms of the build system, it is exactly the same as
fossil
. The project is already integrated with the ROS ecosystem, so we are also covered on that side. That is a nice cherry on top. When an RViz visualization of the grid is introduced, Kinematic-ICP will immediately benefit.Why not OpenVDB
I don't want to deal with 20 dependencies and an ugly Cmake script that does madness with
FetchContent,
Bonxai is much smaller and does precisely what we need it for.This PR
I keep the same API as the
VoxelHashMap
but change the type name and the internal map representation. Everything else will be the same for the user.Please give me feedback on this @benemer @nachovizzo