Skip to content

Draft: [feat] Test to improve KdTree performances

Arthur Bourbousson requested to merge ROS2/feat/UseDynamicKDTree into feat/ROS2

Max Leaf Size KdTree parameter benchmark

This parameter changes the maximum size of the leaf of the KdTree. The variable needs a benchmark of the used program to find the best value (see nanoflann repository). The current value is 16, the tests have been on 10, 20 and 30 using the Slam test package. I only compare the mean time difference between 2 Slam instances.

  • Car loop
    • 10: +1ms
    • 20: +1ms
    • 30: +4ms
  • Mobile_objet
    • 10: +5ms
    • 20: +2ms
    • 30: -0.25ms

Conclusion : the differences are not significant and it almost always slows down the whole Slam process.

Dynamic KdTree

Changes

See commit "[feat] Use dynamic kdtree" for the implementation details.

The tests indicate a small perf improvement when building the KdTree but the counterpart is a huge time increase during the NN searches.

Results

The script to perform the comparison is inside the repository.

python3 logfiles_slam_node/check_localization_time.py logfiles_slam_node/car_loop/dynamic_kdtree.txt logfiles_slam_node/car_loop/static_kdtree.txt

With Keyframe thresholds (the KdTree is not built every frame)

Bag diff kdtree build time diff ICP process time
VLP16 Car Loop -0.12ms +44.79ms
VLP32 Quick Loop -0.33ms +4.15ms

Without keyframe threshold (the kdTree is rebuilt every frame)

Bag diff kdtree build time diff ICP process time
VLP16 Car Loop -8.10ms +5.81ms
VLP32 Quick Loop +0.11ms +14ms
VLP16 D7E -7.41ms +13.53ms
Edited by Arthur Bourbousson

Merge request reports