problems with pcl/tutorial page
hi there! I have been trying to solve the building errors the whole day,but it turned out to be in vain.In the pcl/tutorial page,I have followed the tutorial step by step correctly,but when i use "catkin_make" command to build the package,numerous errors jumped out!I don't know whether the tutorial has some defects or my program exists some faults.please give me a hand,thank you! program as following:
#include <ros/ros.h>
#include <sensor_msgs/PointCloud2.h>
#include <pcl_conversions/pcl_conversions.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/filters/voxel_grid.h>
#include <pcl/conversions.h>
#include <pcl/PCLPointCloud2.h>
ros::Publisher pub;
void cloud_cb(const sensor_msgs::PointCloud2ConstPtr& cloud)
{
// pcl::PCLPointCloud2 pcl_pc;
//pcl::PointCloud<pcl::PointXYZ> cloud_out;
sensor_msgs::PointCloud2 cloud_filtered;
//pcl_conversions::toPCL(*cloud,pcl_pc);
// pcl::fromROSMsg (pcl_pc,cloud_in);
pcl::VoxelGrid<sensor_msgs::PointCloud2> sor;
sor.setInputCloud(*cloud);
sor.setLeafSize(0.01,0.01,0.01);
sor.filter(cloud_filtered);
// pcl::fromPCLPointCloud2(pcl_pc,cloud_out);
pub.publish(cloud_filtered);
}
int main(int argc,char**argv)
{
ros::init(argc,argv,"my_pcl_tutorial");
ros::NodeHandle nh;
ros::Subscriber sub=nh.subscribe("cloud2",1,cloud_cb);
pub=nh.advertise<sensor_msgs::PointCloud2> ("cloud_filtered",1);
ros::spin();
}
We could better help you if you attach the errors that you encounter :)