Go to the documentation of this file.00001
00060
00061
00062
00063
00064
00065 #include <ros/ros.h>
00066 #include <pluginlib/class_list_macros.h>
00067 #include <nodelet/nodelet.h>
00068 #include <pcl_ros/point_cloud.h>
00069
00070
00071 #include <pcl/point_types.h>
00072 #include <pcl/filters/passthrough.h>
00073
00074
00075
00076 class IntensityFilter : public nodelet::Nodelet
00077 {
00078 public:
00079 typedef pcl::PointXYZI PointT;
00080 typedef pcl::PointCloud<PointT> PointCloud;
00081
00082
00083 IntensityFilter ()
00084 {
00085
00086 }
00087
00088
00089 ~ IntensityFilter ()
00090 {
00092 }
00093
00094 void
00095 onInit ()
00096 {
00097 n_ = getPrivateNodeHandle ();
00098
00099 point_cloud_sub_ = n_.subscribe ("point_cloud_in", 1, &IntensityFilter::pointCloudSubCallback, this);
00100 point_cloud_pub_ = n_.advertise<PointCloud> ("point_cloud_out", 1);
00101
00102 int lim_min, lim_max;
00103 n_.param ("intensity_min_threshold", lim_min, 2000);
00104 n_.param ("intensity_max_threshold", lim_max, 60000);
00105 filter_.setFilterLimits (lim_min, lim_max);
00106 filter_.setFilterFieldName ("intensity");
00107 }
00108
00109 void
00110 pointCloudSubCallback (PointCloud::ConstPtr pc)
00111 {
00112 PointCloud cloud_filtered;
00113 filter_.setInputCloud (pc);
00114 filter_.filter (cloud_filtered);
00115
00116 point_cloud_pub_.publish (cloud_filtered);
00117 }
00118
00119 protected:
00120 ros::NodeHandle n_;
00121 ros::Subscriber point_cloud_sub_;
00122 ros::Publisher point_cloud_pub_;
00123
00124 pcl::PassThrough<PointT> filter_;
00125 };
00126
00127 PLUGINLIB_DECLARE_CLASS(cob_3d_mapping_filters, IntensityFilter, IntensityFilter, nodelet::Nodelet)
00128