meiqua / pose_refine

cuda icp for 6D pose estimation
BSD 2-Clause "Simplified" License
96 stars 25 forks source link

about cuda_build_kdtree #10

Closed joy-yjl closed 4 years ago

joy-yjl commented 4 years ago

Hi: I follow the branch cuda_build_kdtree .I find there is a bug at pcd_scene.cu line 171 num_nodes_now_host = num_nodes_now_dev;

I change it to 'thrust::copy(num_nodes_now_dev.begin(), num_nodes_now_dev.end(), num_nodes_now_host.begin());' . But it have a bug, too.

Did you test this code?

joy-yjl commented 4 years ago

I think you can not copy host to device like this:

//root nodes_dev.resize(1); Node_kdtree root_host; root_host.left = 0; root_host.right = pcd_buffer.size(); nodes_dev[0] = root_host;

nodes_dev in device but root_host in host

meiqua commented 4 years ago

I can't remember if the codes are fully tested. I will have a look recently. For nodes_dev = root_host, it is a special thrust syntax, referring to thrust wiki .
Well, after reading codes for a while, I find that at that time I thought it's not necessary to build kdtree on cuda if calculating normals on cpu, so it was not tested then...

meiqua commented 4 years ago

Interesting, after some debug, I find the error is simply because we should re-assign pointer after resizing the thrust vector. Adding this line should be OK.

joy-yjl commented 4 years ago

Interesting, after some debug, I find the error is simply because we should re-assign pointer after resizing the thrust vector. Adding this line should be OK.

Thanks for that. I will continue to learn