pcl::PassThrough<sensor_msgs::PointCloud2> generates error
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
Asked by Poseidonius on 2014-04-29 18:55:56 UTC
Answers
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.
Asked by fergs on 2014-04-29 22:17:01 UTC
Comments
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
Asked by Poseidonius on 2014-04-30 03:01:32 UTC
Comments