ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

pcl::PassThrough<sensor_msgs::PointCloud2> generates error

asked 2014-04-29 18:55:56 -0500

Poseidonius gravatar image

updated 2014-04-29 19:27:18 -0500

Hi,

when I create a PCL Passtrough Filter object (pcl::PassThrough) in a simple code fragment

#include "ros/ros.h" 
#include <sensor_msgs/PointCloud2.h>
#include <pcl/filters/passthrough.h>

int main(int argc, char **argv) 
{
    ros::init(argc, argv, "PointCloud2Filter");
    ros::NodeHandle n;
    pcl::PassThrough<sensor_msgs::PointCloud2> pass;
    return 0;
 }

I get the following error message while compilation on my system (Kubuntu 12.10, ROS Hydro, PCL 1.7)

In file included from /usr/include/pcl-1.7/pcl/point_cloud.h:50:0,
             from /usr/include/pcl-1.7/pcl/pcl_base.h:53,
             from /usr/include/pcl-1.7/pcl/filters/filter.h:43,
             from /usr/include/pcl-1.7/pcl/filters/filter_indices.h:43,
             from /usr/include/pcl-1.7/pcl/filters/passthrough.h:43,
             from /home/zug/Workspace/ROS-Projects/RoboMix/src/PointCloudToImage.cpp:4:
/usr/include/pcl-1.7/pcl/point_traits.h: In instantiation of ‘struct  pcl::traits::fieldList<sensor_msgs::PointCloud2_<std::allocator<void> > >’:
/usr/include/pcl-1.7/pcl/filters/passthrough.h:86:61:   required from ‘class  pcl::PassThrough<sensor_msgs::PointCloud2_<std::allocator<void> > >’
/home/zug/Workspace/ROS-Projects/RoboMix/src/PointCloudToImage.cpp:11:46:   required from here
/usr/include/pcl-1.7/pcl/point_traits.h:152:12: error: invalid use of incomplete type ‘struct pcl::traits::fieldList<sensor_msgs::PointCloud2_<std::allocator<void> > >’
/usr/include/pcl-1.7/pcl/point_traits.h:152:12: error: declaration of ‘struct pcl::traits::fieldList<sensor_msgs::PointCloud2_<std::allocator<void> > >’
/usr/include/pcl-1.7/pcl/point_traits.h:158:7: error: no matching function for call to ‘assertion_failed(mpl_::failed************ (pcl::traits::fieldList<sensor_msgs::PointCloud2_<std::allocator<void> > >::POINT_TYPE_NOT_PROPERLY_REGISTERED::************)(sensor_msgs::PointCloud2_<std::allocator<void> >&))’

What's wrong? Thanks for your help!

Sebastian

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2014-04-30 03:01:32 -0500

Poseidonius gravatar image

Thanks for your advice fergs! Now I have problems with cast operators and pcl data types ...

 void cloudCallback(const sensor_msgs::PointCloud2ConstPtr& ros_cloud)
 {
       // convert ros -> pcl related to PCL 1.7
       pcl::PCLPointCloud2 pcl_cloud;
       pcl_conversions::toPCL(*ros_cloud, pcl_cloud);   
       // Create the pcl filtering object
       pcl::PassThrough<pcl::PCLPointCloud2> pass;
       pass.setInputCloud(pcl_cloud);  // <-- does not work, we need a cast operator here
                                                                to pcl::PointCloud2ConstPtr&
  }

I guess it is not possible to generate a pcl::PointCloud2ConstPtr& from struct pcl::PCLPointCloud2? How can I solve the problem?

Thanks a lot

Sebastian

edit flag offensive delete link more
0

answered 2014-04-29 22:17:01 -0500

fergs gravatar image

In PCL1.7 & Hydro, the sensor_msgs have been removed from PCL, and renamed. Take a look at the pcl_conversions package, which allows converting to pcl::PointCloud<> from sensor_msgs.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2014-04-29 18:55:56 -0500

Seen: 1,923 times

Last updated: Apr 30 '14