-
Notifications
You must be signed in to change notification settings - Fork 493
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
KDTreeSingleIndexDynamicAdaptor is mush slower than KDTreeSingleIndexAdaptor #104
Comments
Here is my code: namespace nanoflann { template private: PointCloudConstPtr point_cloud_; public: void addNewCloud(const PointCloudPtr& new_cloud) { inline size_t kdtree_get_point_count() const { inline float kdtree_get_pt(const size_t idx, int dim) const { template template DynamicKdTreeFLANN(const DynamicKdTreeFLANN& rhs) = delete; private: SearchParams params_; public: typedef typename pcl::PointCloud PointCloud; inline Ptr makeShared() { return Ptr(new DynamicKdTreeFLANN(*this)); } void setEpsilon(float eps) { params_.eps = eps; } void setSortedResults(bool sorted) { params_.sorted = sorted; } void setInputCloud(const PointCloudPtr& cloud) { void AddNewCloud(const PointCloudPtr& new_cloud) { int nearestKSearch(const PointT& point, int num_closest, int radiusSearch(const PointT& point, double radius, } // namespace nanoflann |
Did you ever come closer to a possible solution to the problem? |
Nope, I've accept this fact. I think if you need to add points frequently, KDTreeSingleIndexDynamicAdaptor is better.If not, KDTreeSingleIndexAdaptor is faster. |
From what I can tell, instead of using Thoughts on this change? |
Thank you for your reply. I'm sorry that I don't understand the internal principal of KDTreeSingleIndexDynamicAdaptor clearly. I just use it as https://github.com/jlblancoc/nanoflann/blob/master/examples/dynamic_pointcloud_example.cpp |
@getupgetup Facing the same issue for large 3D pointclouds. Did you resolve this with nanoflann or moved to another library? Any help would be appreciated. |
Well, it seems that KDTreeSingleIndexDynamicAdaptor is slower than KDTreeSingleIndexAdaptor. Fortunately for me, kdtree is updated frequently so that KDTreeSingleIndexDynamicAdaptor is much better than KDTreeSingleIndexAdaptor. PS: I tried to modifiy the code by @ibtaylor 's advice but it seemed not very useful. The efficiency increased by only 1-2%. |
@getupgetup can you put together a gist with simple cases that shows the 2.5x slowdown? |
@getupgetup Thank you for the quick reply. |
It has been a long time since my project finished. I used KDTreeSingleIndexDynamicAdaptor to update my map for localizing(ICP match). The update frequecy is about 10Hz and the average size of points updated is about 10e3。 |
It has been a long time since my project finished. I need to take some time to clean up my code if I'm free. |
See #139 |
Great! Thank you! |
Hi, I'm using nanoflann to construct a class called KdTreeFLANN in order to replace pcl::KdTreeFLANN. It is almost the same as the practice in https://github.com/laboshinl/loam_velodyne. It is based on nanoflann::KDTreeSingleIndexAdaptor, so it can't add/remove points dynamicly. Then I noticed nanoflann::KDTreeSingleIndexDynamicAdaptor which support add/remove points.So I change my class to support adding points dynamicly by nanoflann::KDTreeSingleIndexDynamicAdaptor. However, I found that it consumes about 2.5x time compared with the one before changing using the same point cloud data. Is it common or am I missing something or using anying wrongly?
The text was updated successfully, but these errors were encountered: