speckle_filter.cpp
Go to the documentation of this file.
00001 
00060 //##################
00061 //#### includes ####
00062 // standard includes
00063 //--
00064 // ROS includes
00065 #include <ros/ros.h>
00066 #include <pcl_ros/point_cloud.h>
00067 #include <pluginlib/class_list_macros.h>
00068 #include <nodelet/nodelet.h>
00069 
00070 // pcl includes
00071 #include <pcl/point_types.h>
00072 
00073 // cob_3d_mapping_filters includes
00074 //#include <cob_3d_mapping_common/point_types.h>
00075 #include <cob_3d_mapping_filters/speckle_filter.h>
00076 #include <cob_3d_mapping_filters/impl/speckle_filter.hpp>
00077 
00078 //######################
00079 //#### nodelet class####
00080 class SpeckleFilter : public nodelet::Nodelet
00081 {
00082 public:
00083   typedef pcl::PointXYZ PointT;
00084   typedef pcl::PointCloud<PointT> PointCloud;
00085 
00086   // Constructor
00087   SpeckleFilter ()
00088   {
00089     //
00090   }
00091 
00092   // Destructor
00093   ~ SpeckleFilter ()
00094   {
00096   }
00097 
00098   void
00099   onInit ()
00100   {
00101     n_ = getPrivateNodeHandle ();
00102 
00103     point_cloud_sub_ = n_.subscribe ("point_cloud_in", 1, &SpeckleFilter::pointCloudSubCallback, this);
00104     point_cloud_pub_ = n_.advertise<PointCloud> ("point_cloud_out", 1);
00105 
00106     int speckle_size;
00107     double speckle_range;
00108     n_.param ("speckle_size", speckle_size, 50);
00109     n_.param ("speckle_range", speckle_range, 0.1);
00110     filter_.setFilterParam (speckle_size, speckle_range);
00111   }
00112 
00113   void
00114   pointCloudSubCallback (const PointCloud::ConstPtr pc)
00115   {
00116     PointCloud cloud_filtered;
00117     filter_.setInputCloud (pc);
00118     filter_.filter (cloud_filtered);
00119 
00120     point_cloud_pub_.publish (cloud_filtered);
00121   }
00122 
00123 protected:
00124   ros::NodeHandle n_;
00125   ros::Subscriber point_cloud_sub_;
00126   ros::Publisher point_cloud_pub_;
00127 
00128   cob_3d_mapping_filters::SpeckleFilter<PointT> filter_;
00129 };
00130 
00131 PLUGINLIB_DECLARE_CLASS(cob_3d_mapping_filters, SpeckleFilter, SpeckleFilter, nodelet::Nodelet)
00132 


cob_3d_mapping_filters
Author(s): Georg Arbeiter
autogenerated on Wed Aug 26 2015 11:02:54