00001 // Copyright (C) 2010-2011 Institut de Robotica i Informatica Industrial, CSIC-UPC. 00002 // Author David MartÃnez 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 _plane_segmentation_pcl_rgb_alg_node_h_ 00026 #define _plane_segmentation_pcl_rgb_alg_node_h_ 00027 00028 #include <iri_base_algorithm/iri_base_algorithm.h> 00029 #include "plane_segmentation_pcl_rgb_alg.h" 00030 00031 // [publisher subscriber headers] 00032 #include <sensor_msgs/Image.h> 00033 #include <pcl/ModelCoefficients.h> 00034 #include <sensor_msgs/PointCloud2.h> 00035 00036 // [service client headers] 00037 //#include <iri_plane_segmentation_pcl_rgb/segment.h> UNUSED 00038 00039 // [action server client headers] 00040 00041 // other 00042 // Pointclouds 00043 //#include <pcl/point_cloud.h> 00044 #include <pcl_conversions/pcl_conversions.h> 00045 00046 // opencv 00047 #include <opencv2/imgproc/imgproc.hpp> 00048 00049 // cvmat to rosmsg 00050 #include <cv_bridge/cv_bridge.h> 00051 #include <sensor_msgs/image_encodings.h> 00052 00057 class PlaneSegmentationPclRgbAlgNode : public algorithm_base::IriBaseAlgorithm<PlaneSegmentationPclRgbAlgorithm> 00058 { 00059 private: 00060 // [publisher attributes] 00061 ros::Publisher segmented_image_publisher_; 00062 sensor_msgs::Image Image_msg_; 00063 ros::Publisher plane_coefficients_publisher_; 00064 pcl_msgs::ModelCoefficients ModelCoefficients_msg_; 00065 ros::Publisher pointcloud_out_publisher_; 00066 sensor_msgs::PointCloud2 PointCloud2_msg_; 00067 00068 // [subscriber attributes] 00069 ros::Subscriber pointcloud_in_subscriber_; 00070 void pointcloud_in_callback(const sensor_msgs::PointCloud2::ConstPtr& msg); 00071 CMutex pointcloud_in_mutex_; 00072 00073 // [service attributes] 00074 //ros::ServiceServer segment_server_; UNUSED 00075 //bool segmentCallback(iri_plane_segmentation_pcl_rgb::segment::Request &req, iri_plane_segmentation_pcl_rgb::segment::Response &res); UNUSED 00076 CMutex segment_mutex_; 00077 00078 // [client attributes] 00079 00080 // [action server attributes] 00081 00082 // [action client attributes] 00083 00084 // Other methods 00085 00091 cv::Mat pointcloud_to_image(pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud); 00092 00098 sensor_msgs::ImagePtr cvimage_to_rosimage(cv::Mat cvimage, std_msgs::Header header); 00099 00100 00101 public: 00108 PlaneSegmentationPclRgbAlgNode(void); 00109 00116 ~PlaneSegmentationPclRgbAlgNode(void); 00117 00118 protected: 00131 void mainNodeThread(void); 00132 00145 void node_config_update(Config &config, uint32_t level); 00146 00153 void addNodeDiagnostics(void); 00154 00155 // [diagnostic functions] 00156 00157 // [test functions] 00158 }; 00159 00160 #endif