template argument deduction/substitution failed

asked 2016-04-06 07:26:11 -0500

Nxzx gravatar image

Hello, I'm having trouble with the following function:

pcl::fromPCLPointCloud2(pcl_pc, cloud);

pcl_pc and cloud are:

pcl::PCLPointCloud2 pcl_pc;
typedef pcl::PointXYZRGBA PointT; 
typedef pcl::PointCloud<PointT> PointCloudT;
PointCloudT::Ptr cloud (new PointCloudT);

So I'm making the use of:

void cloud_cb (const sensor_msgs::PointCloud2 input) { ... }

I pass the input as a parameter to the function:

pcl_conversions::toPCL(input, pcl_pc);

No problem, and I do the operations with the "cloud" and in the end I try to use the function:

pcl::fromPCLPointCloud2(pcl_pc, cloud);

To pass the pcl_pc with the cloud's content to show what operations I've done with the code on rviz, but, I get the following error:

  fromPCLPointCloud2 (const pcl::PCLPointCloud2& msg, pcl::PointCloud<PointT>& cloud,
  ^
  /usr/include/pcl-1.7/pcl/conversions.h:167:3: note:   template argument deduction/substitution failed:

  /home/yooh/workspace/rosNL/src/rosNLV0.0.1.1.cpp:382:38: note:
  ‘pcl::PointCloud<pcl::PointXYZRGBA>::Ptr {aka boost::shared_ptr<pcl::PointCloud<pcl::PointXYZRGBA> >}
  ’ is not derived from ‘pcl::PointCloud<PointT>’

   pcl::fromPCLPointCloud2(pcl_pc, cloud);
                                        ^
  In file included from /opt/ros/indigo/include/pcl_conversions/pcl_conversions.h:44:0,
  from /home/yooh/workspace/rosNL/src/rosNLV0.0.1.1.cpp:4:

  /usr/include/pcl-1.7/pcl/conversions.h:225:3: note: 
  template<class PointT> void pcl::fromPCLPointCloud2(const pcl::PCLPointCloud2&, pcl::PointCloud<PointT>&)

  fromPCLPointCloud2 (const pcl::PCLPointCloud2& msg, pcl::PointCloud<PointT>& cloud)
  ^
  /usr/include/pcl-1.7/pcl/conversions.h:225:3: note:   template argument deduction/substitution failed:

  /home/yooh/workspace/rosNL/src/rosNLV0.0.1.1.cpp:382:38: note:
  ‘pcl::PointCloud<pcl::PointXYZRGBA>::Ptr {aka boost::shared_ptr<pcl::PointCloud<pcl::PointXYZRGBA> >}
  ’ is not derived from ‘pcl::PointCloud<PointT>’

   pcl::fromPCLPointCloud2(pcl_pc, cloud);
edit retag flag offensive close merge delete