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 _cleaning_plan_alg_node_h_ 00026 #define _cleaning_plan_alg_node_h_ 00027 00028 #include <iri_base_algorithm/iri_base_algorithm.h> 00029 #include "cleaning_plan_alg.h" 00030 #include "ellipses_representation.h" 00031 00032 // [publisher subscriber headers] 00033 #include <sensor_msgs/Image.h> 00034 #include <visualization_msgs/MarkerArray.h> 00035 #include <visualization_msgs/Marker.h> 00036 00037 // [service client headers] 00038 #include <estirabot_msgs/RepresentationToString.h> 00039 #include <iri_clean_board/StateRepresentation.h> 00040 #include <iri_clean_board/PlanToTrajectories.h> 00041 #include <estirabot_msgs/StateRepresentationChanges.h> 00042 #include <iri_planning_msgs/PradaPlanSrv.h> 00043 00044 // [action server client headers] 00045 00046 // tf 00047 #include <tf/transform_broadcaster.h> 00048 #include <tf/transform_datatypes.h> 00049 00050 // other 00051 #include <sensor_msgs/PointCloud2.h> 00052 00053 00058 class CleaningPlanAlgNode : public algorithm_base::IriBaseAlgorithm<CleaningPlanAlgorithm> 00059 { 00060 private: 00061 // [publisher attributes] 00062 ros::Publisher image_plan_out_publisher_; 00063 sensor_msgs::Image Image_msg_; 00064 ros::Publisher visualization_markers_publisher_; 00065 visualization_msgs::MarkerArray MarkerArray_msg_; 00066 00067 // [subscriber attributes] 00068 00069 // [service attributes] 00070 ros::ServiceServer representation_to_string_server_; 00071 bool representation_to_stringCallback(estirabot_msgs::RepresentationToString::Request &req, estirabot_msgs::RepresentationToString::Response &res); 00072 CMutex representation_to_string_mutex_; 00073 ros::ServiceServer get_dirty_areas_state_representation_server_; 00074 bool get_dirty_areas_state_representationCallback(iri_clean_board::StateRepresentation::Request &req, iri_clean_board::StateRepresentation::Response &res); 00075 CMutex get_dirty_areas_state_representation_mutex_; 00076 ros::ServiceServer get_trajectories_from_plan_server_; 00077 bool get_trajectories_from_planCallback(iri_clean_board::PlanToTrajectories::Request &req, iri_clean_board::PlanToTrajectories::Response &res); 00078 CMutex get_trajectories_from_plan_mutex_; 00079 00080 // [client attributes] 00081 00082 // [action server attributes] 00083 00084 // [action client attributes] 00085 00086 // Ellipses representation 00087 EllipsesRepresentation ellipses_representation; 00088 00089 // Other 00090 tf::TransformBroadcaster br; 00091 00092 // parameters 00093 uint32_t max_number_actions; 00094 bool no_planning; 00095 bool board_plan; 00096 bool no_perception; 00097 std::string file_planner_state; 00098 00099 00100 // debugging functions 00101 void show_dirty_areas_information(sensor_msgs::PointCloud2 pointcloud, std::vector< estirabot_msgs::DirtyArea > dirty_areas); 00102 00103 00104 00105 public: 00112 CleaningPlanAlgNode(void); 00113 00120 ~CleaningPlanAlgNode(void); 00121 00122 protected: 00135 void mainNodeThread(void); 00136 00149 void node_config_update(Config &config, uint32_t level); 00150 00157 void addNodeDiagnostics(void); 00158 00159 // [diagnostic functions] 00160 00161 // [test functions] 00162 00163 // auxiliary functions 00164 00165 void savePlanningResponse(iri_clean_board::PlanToTrajectories::Request req, 00166 iri_clean_board::PlanToTrajectories::Response &res); 00167 00168 void getNearestCleanPlan(iri_clean_board::PlanToTrajectories::Request req, iri_clean_board::PlanToTrajectories::Response &res); 00169 00170 void getNoPerceptionCleanPlan(iri_clean_board::PlanToTrajectories::Request req, iri_clean_board::PlanToTrajectories::Response &res); 00171 }; 00172 00173 #endif