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 _get_board_information_alg_node_h_ 00026 #define _get_board_information_alg_node_h_ 00027 00028 #include <iri_base_algorithm/iri_base_algorithm.h> 00029 #include "get_board_information_alg.h" 00030 00031 // [publisher subscriber headers] 00032 #include <estirabot_msgs/ImagePoint.h> 00033 #include <pcl_msgs/ModelCoefficients.h> 00034 #include <sensor_msgs/Image.h> 00035 #include <sensor_msgs/PointCloud2.h> 00036 00037 // [service client headers] 00038 #include <iri_clean_board/BoardInfo.h> 00039 00040 // [action server client headers] 00041 00042 // other 00043 #include <opencv2/highgui/highgui.hpp> 00044 00045 // events 00046 #include "eventexceptions.h" 00047 #include "event.h" 00048 00053 class GetBoardInformationAlgNode : public algorithm_base::IriBaseAlgorithm<GetBoardInformationAlgorithm> 00054 { 00055 private: 00056 // [publisher attributes] 00057 ros::Publisher believe_status_publisher_; 00058 sensor_msgs::Image Image_msg_; 00059 ros::Publisher pointcloud_out_publisher_; 00060 sensor_msgs::PointCloud2 PointCloud2_msg_; 00061 00062 // [subscriber attributes] 00063 ros::Subscriber unreachable_position_subscriber_; 00064 void unreachable_position_callback(const estirabot_msgs::ImagePoint::ConstPtr& msg); 00065 CMutex unreachable_position_mutex_; 00066 ros::Subscriber plane_coefficients_subscriber_; 00067 void plane_coefficients_callback(const pcl_msgs::ModelCoefficients::ConstPtr& msg); 00068 CMutex plane_coefficients_mutex_; 00069 ros::Subscriber pointcloud_in_subscriber_; 00070 void pointcloud_in_callback(const sensor_msgs::PointCloud2::ConstPtr& msg); 00071 CMutex pointcloud_in_mutex_; 00072 ros::Subscriber image_in_subscriber_; 00073 void image_in_callback(const sensor_msgs::Image::ConstPtr& msg); 00074 CMutex image_in_mutex_; 00075 00076 // [service attributes] 00077 ros::ServiceServer get_board_info_server_; 00078 bool get_board_infoCallback(iri_clean_board::BoardInfo::Request &req, iri_clean_board::BoardInfo::Response &res); 00079 CMutex get_board_info_mutex_; 00080 00081 // [client attributes] 00082 00083 // [action server attributes]; 00084 00085 // [action client attributes] 00086 00087 // other 00088 bool is_service_waiting; 00089 bool waiting_for_pointcloud; 00090 bool waiting_for_image; 00091 bool waiting_for_coefficients; 00092 00093 sensor_msgs::PointCloud2 last_pointcloud; 00094 sensor_msgs::PointCloud2 current_pointcloud; 00095 00096 sensor_msgs::Image last_image; 00097 sensor_msgs::Image current_image; 00098 00099 pcl_msgs::ModelCoefficients last_plane_coeffs; 00100 pcl_msgs::ModelCoefficients current_plane_coeffs; 00101 00102 CEvent EventInfoReady, EventServiceWaiting; 00103 00109 void publish_a_pointcloud(); 00110 00111 public: 00118 GetBoardInformationAlgNode(void); 00119 00126 ~GetBoardInformationAlgNode(void); 00127 00128 protected: 00141 void mainNodeThread(void); 00142 00155 void node_config_update(Config &config, uint32_t level); 00156 00163 void addNodeDiagnostics(void); 00164 00165 // [diagnostic functions] 00166 00167 // [test functions] 00168 }; 00169 00170 #endif