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 _map_location_alg_node_h_ 00026 #define _map_location_alg_node_h_ 00027 00028 #include <iri_base_algorithm/iri_base_algorithm.h> 00029 #include "map_location_alg.h" 00030 00031 #include <image_transport/image_transport.h> 00032 00033 00034 //#include <cv_bridge/CvBridge.h> 00035 #include <cv_bridge/cv_bridge.h> 00036 #include <sensor_msgs/image_encodings.h> 00037 00038 // [publisher subscriber headers] 00039 #include <std_msgs/String.h> 00040 #include <geometry_msgs/PoseArray.h> 00041 00042 // [service client headers] 00043 00044 // [action server client headers] 00045 00046 00051 class MapLocationAlgNode : public algorithm_base::IriBaseAlgorithm<MapLocationAlgorithm> 00052 { 00053 private: 00054 // [publisher attributes] 00055 image_transport::ImageTransport it_; 00056 image_transport::Publisher img_pub_; 00057 00058 00059 // [subscriber attributes] 00060 ros::Subscriber mapcode_subscriber_; 00061 void mapcode_callback(const std_msgs::String::ConstPtr& msg); 00062 CMutex mapcode_mutex_; 00063 ros::Subscriber locations_subscriber_; 00064 void locations_callback(const geometry_msgs::PoseArray::ConstPtr& msg); 00065 CMutex locations_mutex_; 00066 00067 // [service attributes] 00068 00069 // [client attributes] 00070 00071 // [action server attributes] 00072 00073 // [action client attributes] 00074 00075 sensor_msgs::ImagePtr img_msg; 00076 geometry_msgs::PoseArray locations; 00077 00078 int t; 00079 int mapCode_; 00080 void updateLocations(); 00081 void updateImage(); 00082 00083 public: 00090 MapLocationAlgNode(void); 00091 00098 ~MapLocationAlgNode(void); 00099 00100 protected: 00113 void mainNodeThread(void); 00114 00127 void node_config_update(Config &config, uint32_t level); 00128 00135 void addNodeDiagnostics(void); 00136 00137 // [diagnostic functions] 00138 00139 // [test functions] 00140 }; 00141 00142 #endif