Now, we are going to implement a program to generate a node that filters the point cloud from the Kinect sensor. This node will apply a filter to reduce the number of points in the original data. It will make a down sampling of the data.
Create a new file, c8_kinect.cpp, in your chapter8_tutorials/src directory and type in the following code snippet:
#include <ros/ros.h> #include <sensor_msgs/PointCloud2.h> // PCL specific includes #include <pcl_conversions/pcl_conversions.h> #include <pcl/point_cloud.h> #include <pcl/point_types.h> #include <pcl/filters/voxel_grid.h> #include <pcl/io/pcd_io.h> ros::Publisher pub; void cloud_cb (const pcl::PCLPointCloud2ConstPtr& input) { pcl::PCLPointCloud2 cloud_filtered; ...