gaussian_voxelmap.cuh 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef FAST_GICP_CUDA_GAUSSIAN_VOXELMAP_CUH
  2. #define FAST_GICP_CUDA_GAUSSIAN_VOXELMAP_CUH
  3. #include <Eigen/Core>
  4. #include <thrust/host_vector.h>
  5. #include <thrust/device_vector.h>
  6. namespace fast_gicp {
  7. namespace cuda {
  8. struct VoxelMapInfo {
  9. int num_voxels;
  10. int num_buckets;
  11. int max_bucket_scan_count;
  12. float voxel_resolution;
  13. };
  14. class GaussianVoxelMap {
  15. public:
  16. GaussianVoxelMap(float resolution, int init_num_buckets = 8192, int max_bucket_scan_count = 10);
  17. void create_voxelmap(const thrust::device_vector<Eigen::Vector3f>& points);
  18. void create_voxelmap(const thrust::device_vector<Eigen::Vector3f>& points, const thrust::device_vector<Eigen::Matrix3f>& covariances);
  19. private:
  20. void create_bucket_table(cudaStream_t stream, const thrust::device_vector<Eigen::Vector3f>& points);
  21. public:
  22. const int init_num_buckets;
  23. VoxelMapInfo voxelmap_info;
  24. thrust::device_vector<VoxelMapInfo> voxelmap_info_ptr;
  25. thrust::device_vector<thrust::pair<Eigen::Vector3i, int>> buckets;
  26. // voxel data
  27. thrust::device_vector<int> num_points;
  28. thrust::device_vector<Eigen::Vector3f> voxel_means;
  29. thrust::device_vector<Eigen::Matrix3f> voxel_covs;
  30. };
  31. } // namespace cuda
  32. } // namespace fast_gicp
  33. #endif