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 _camera_object_learner_server_alg_node_h_ 00026 #define _camera_object_learner_server_alg_node_h_ 00027 00028 #include <iri_base_algorithm/iri_base_algorithm.h> 00029 #include "camera_object_learner_server_alg.h" 00030 #include <image_geometry/pinhole_camera_model.h> 00031 00032 // [publisher subscriber headers] 00033 #include <sensor_msgs/CameraInfo.h> 00034 #include <iri_perception_msgs/detectionArray.h> 00035 00036 // [service client headers] 00037 #include <iri_camera_object_learner_server/init.h> 00038 00039 // [action server client headers] 00040 00041 #include <tf/transform_listener.h> 00042 #include <geometry_msgs/PointStamped.h> 00043 00048 class CameraObjectLearnerServerAlgNode : public algorithm_base::IriBaseAlgorithm<CameraObjectLearnerServerAlgorithm> 00049 { 00050 private: 00051 // [publisher attributes] 00052 00053 // [subscriber attributes] 00054 ros::Subscriber camera_info_subscriber_; 00055 void camera_info_callback(const sensor_msgs::CameraInfo::ConstPtr& msg); 00056 CMutex camera_info_mutex_; 00057 ros::Subscriber people_subscriber_; 00058 void people_callback(const iri_perception_msgs::detectionArray::ConstPtr& msg); 00059 CMutex people_mutex_; 00060 00061 // [service attributes] 00062 ros::ServiceServer init_server_; 00063 bool initCallback(iri_camera_object_learner_server::init::Request &req, iri_camera_object_learner_server::init::Response &res); 00064 CMutex init_mutex_; 00065 00066 // [client attributes] 00067 00068 // [action server attributes] 00069 00070 // [action client attributes] 00071 00072 image_geometry::PinholeCameraModel camera_model; 00073 cv::Rect init_rect; 00074 geometry_msgs::PointStamped init_point; 00075 00076 bool received_person; 00077 bool received_camera_info; 00078 bool init; 00079 bool compute_init_rect(); 00080 00081 double window_width; 00082 double window_height; 00083 double window_offset; 00084 00085 tf::TransformListener tf_listener; 00086 00087 public: 00094 CameraObjectLearnerServerAlgNode(void); 00095 00102 ~CameraObjectLearnerServerAlgNode(void); 00103 00104 protected: 00117 void mainNodeThread(void); 00118 00131 void node_config_update(Config &config, uint32_t level); 00132 00139 void addNodeDiagnostics(void); 00140 00141 // [diagnostic functions] 00142 00143 // [test functions] 00144 }; 00145 00146 #endif