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 _laser_people_detection_alg_node_h_ 00026 #define _laser_people_detection_alg_node_h_ 00027 00028 #include <iri_base_algorithm/iri_base_algorithm.h> 00029 #include "laser_people_detection_alg.h" 00030 00031 // [publisher subscriber headers] 00032 #include <sensor_msgs/LaserScan.h> 00033 #include <visualization_msgs/MarkerArray.h> 00034 #include <iri_perception_msgs/detectionArray.h> 00035 00036 // [service client headers] 00037 00038 // [action server client headers] 00039 00040 #include <tf/transform_listener.h> 00041 00046 class LaserPeopleDetectionAlgNode : public algorithm_base::IriBaseAlgorithm<LaserPeopleDetectionAlgorithm> 00047 { 00048 private: 00049 // [publisher attributes] 00050 ros::Publisher peopleMarkers_array_publisher_; 00051 visualization_msgs::MarkerArray MarkerArray_msg_; 00052 00053 ros::Publisher people_publisher_; 00054 iri_perception_msgs::detectionArray detectionArray_msg_; 00055 00056 // [subscriber attributes] 00057 ros::Subscriber scan_subscriber_; 00058 void scan_callback(const sensor_msgs::LaserScan::ConstPtr& msg); 00059 CMutex scan_mutex_; 00060 00061 // [service attributes] 00062 00063 // [client attributes] 00064 00065 // [action server attributes] 00066 00067 // [action client attributes] 00068 00069 // [class atributes] 00070 CEventServer * event_server_; 00071 std::string new_laser_event_id_; 00072 00073 sensor_msgs::LaserScan currentScan; 00074 00075 void init(); 00076 void transformPoses(iri_perception_msgs::detectionArray & peoplePoses); 00077 void filterPoses(iri_perception_msgs::detectionArray & peoplePoses); 00078 void getPeopleMarkers(iri_perception_msgs::detectionArray & peopleList, visualization_msgs::MarkerArray & people); 00079 00080 double rangeThreshold; 00081 double detectionThreshold; 00082 double markerWidth; 00083 double markerHeight; 00084 double markerR; 00085 double markerG; 00086 double markerB; 00087 double markerA; 00088 00089 bool filterPosesMode; 00090 double filterR; 00091 double filterX; 00092 double filterY; 00093 00094 tf::TransformListener tf_listener_; 00095 std::string target_frame; 00096 00097 bool selectPosesFrame; 00098 bool selectScanFrame; 00099 std::string scanFrame; 00100 00101 public: 00108 LaserPeopleDetectionAlgNode(void); 00109 00116 ~LaserPeopleDetectionAlgNode(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