Problems with using custom point type in Point Cloud Library (PCL)t
I came across a problem when trying to register two point clouds using PCL. Instead of using the provided PointT, I used custom point type and followed the tutorial(http://www.pointclouds.org/documentation/tutorials/adding_custom_ptype.php#adding-custom-ptype). However, when I complied the codes in VS2019, it failed. I also tried this post ( https://stackoverflow.com/questions/39221424/pcl-instantiating-new-point-types-for-all-functions). It didn't work neither.
Here is the defination of the point
#ifndef PCL_NO_PRECOMPILE
#define PCL_NO_PRECOMPILE
#endif
#include <iostream>
#include <pcl/pcl_macros.h>
#include <pcl/point_types.h>
#include <pcl/impl/point_types.hpp>
#include <pcl/impl/instantiate.hpp>
#include <pcl/point_cloud.h>
#include <pcl/impl/point_types.hpp>
#include <pcl/common/transforms.h>
#include <pcl/common/impl/transforms.hpp>
#include <pcl/registration/icp.h>
#include <pcl/registration/impl/icp.hpp>
struct dPointXYZ {
double x;
double y;
double z;
};
POINT_CLOUD_REGISTER_POINT_STRUCT(dPointXYZ,
(double, x, x)
(double, y, y)
(double, z, z)
)
This is how I use the custom point type.
void voxelFilteringPoints(pcl::PointCloud<pcl::dPointXYZ>::Ptr& ProjPoint, pcl::PointCloud<pcl::dPointXYZ>::Ptr& filteredPoints, float dGridSize)
{
pcl::VoxelGrid<pcl::dPointXYZ> ApproximateVoxelGrid;
ApproximateVoxelGrid.setLeafSize(dGridSize, dGridSize, dGridSize);
ApproximateVoxelGrid.setInputCloud(ProjPoint);
ApproximateVoxelGrid.filter(*filteredPoints);
//std::cout<<"Filtered points size: "<<*filteredPoints<<std::endl;
}
This is the compiling result:
Error C2953 'pcl::detail::Transformer': class template has already been defined ConsoleApplication1 C:\Program Files\PCL_1.9.1\include\pcl-1.9\pcl\common\impl\transforms.hpp 89
Error C2995 'void pcl::transformPointCloud(const pcl::PointCloud<PointT> &,pcl::PointCloud<PointT> &,const Eigen::Transform<Scalar,3,2,0> &,bool)': function template has already been defined ConsoleApplication1 C:\Program Files\PCL_1.9.1\include\pcl-1.9\pcl\common\impl\transforms.hpp 215
Error C2995 'void pcl::transformPointCloud(const pcl::PointCloud<PointT> &,const std::vector<int,std::allocator<_Ty>> &,pcl::PointCloud<PointT> &,const Eigen::Transform<Scalar,3,2,0> &,bool)': function template has already been defined
ConsoleApplication1 C:\Program Files\PCL_1.9.1\include\pcl-1.9\pcl\common\impl\transforms.hpp 259
I tried to change the definition of the functions in transforms.hpp and transforms.h, it didn't help. Do you have any ideas how to solve the problem?
Asked by ivanll on 2020-01-09 01:01:11 UTC
Comments
There is no mention or use of ROS anywhere in the code or the problem statement. We do use PCL in the ROS community, but this forum is not where PCL developers/maintainers come to support their users.
It would be better to post on the proper fora.
Asked by gvdhoorn on 2020-01-09 03:03:54 UTC