00001 // Copyright (C) 2010-2011 Institut de Robotica i Informatica Industrial, CSIC-UPC. 00002 // Author 00003 // All rights reserved. 00004 // 00005 // This file is part of iri-ros-pkg 00006 // iri-ros-pkg is free software: you can redistribute it and/or modify 00007 // it under the terms of the GNU Lesser General Public License as published by 00008 // the Free Software Foundation, either version 3 of the License, or 00009 // at your option) any later version. 00010 // 00011 // This program is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU Lesser General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU Lesser General Public License 00017 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00018 // 00019 // IMPORTANT NOTE: This code has been generated through a script from the 00020 // iri_ros_scripts. Please do NOT delete any comments to guarantee the correctness 00021 // of the scripts. ROS topics can be easly add by using those scripts. Please 00022 // refer to the IRI wiki page for more information: 00023 // http://wikiri.upc.es/index.php/Robotics_Lab 00024 00025 #ifndef _leaf_segmentation_alg_node_h_ 00026 #define _leaf_segmentation_alg_node_h_ 00027 00028 #include <iri_base_algorithm/iri_base_algorithm.h> 00029 #include "leaf_segmentation_alg.h" 00030 00031 // [publisher subscriber headers] 00032 #include <iri_leaf_segmentation/ClusterSet.h> 00033 #include <sensor_msgs/Image.h> 00034 #include <sensor_msgs/PointCloud2.h> 00035 #include <sensor_msgs/image_encodings.h> 00036 #include <message_filters/subscriber.h> 00037 #include <message_filters/time_synchronizer.h> 00038 00039 // [service client headers] 00040 #include <std_srvs/Empty.h> 00041 #include <iri_leaf_segmentation/GetClusteredImage.h> 00042 // [action server client headers] 00043 00044 // [PCL_ROS] 00045 #include "pcl_ros/point_cloud.h" 00046 #include "pcl/point_types.h" 00047 #include "pcl/ros/register_point_struct.h" 00048 00049 //pcl::toROSMsg 00050 #include <pcl/io/pcd_io.h> 00051 00052 // [opencv2] 00053 #include <opencv2/highgui/highgui.hpp> 00054 #include <opencv2/imgproc/imgproc.hpp> 00055 00056 #include <cv_bridge/CvBridge.h> 00057 #include <cv_bridge/cv_bridge.h> 00058 00063 class LeafSegmentationAlgNode : public algorithm_base::IriBaseAlgorithm<LeafSegmentationAlgorithm> 00064 { 00065 private: 00066 00067 00068 sensor_msgs::Image::ConstPtr rgb_image_; 00069 cv_bridge::CvImagePtr cv_ptr_; 00070 00071 pcl::PointCloud<pcl::PointXYZRGB> pcl_xyzrgb_; 00072 00073 // [publisher attributes] 00074 ros::Publisher cluster_set_publisher_; 00075 iri_leaf_segmentation::ClusterSet cluster_set_msg_; 00076 ros::Publisher output_image_publisher_; 00077 sensor_msgs::Image Image_msg_; 00078 00079 // [subscriber attributes] 00080 00081 // [service attributes] 00082 ros::ServiceServer get_clustered_image_srv_; 00083 bool get_clustered_image_srv_callback(iri_leaf_segmentation::GetClusteredImage::Request &req, iri_leaf_segmentation::GetClusteredImage::Response &res); 00084 00085 // [client attributes] 00086 00087 // [action server attributes] 00088 00089 // [action client attributes] 00090 00091 public: 00098 LeafSegmentationAlgNode(void); 00099 00106 ~LeafSegmentationAlgNode(void); 00107 00108 protected: 00121 void mainNodeThread(void); 00122 00135 void node_config_update(Config &config, uint32_t level); 00136 00143 void addNodeDiagnostics(void); 00144 00145 // [diagnostic functions] 00146 00147 // [test functions] 00148 }; 00149 00150 #endif