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_map_filter_alg_node_h_ 00026 #define _laser_people_map_filter_alg_node_h_ 00027 00028 #include <iri_base_algorithm/iri_base_algorithm.h> 00029 #include "laser_people_map_filter_alg.h" 00030 00031 // [publisher subscriber headers] 00032 #include <visualization_msgs/MarkerArray.h> 00033 #include <nav_msgs/OccupancyGrid.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 LaserPeopleMapFilterAlgNode : public algorithm_base::IriBaseAlgorithm<LaserPeopleMapFilterAlgorithm> 00047 { 00048 private: 00049 // [publisher attributes] 00050 ros::Publisher peopleMarkers_publisher_; 00051 visualization_msgs::MarkerArray MarkerArray_msg_; 00052 ros::Publisher mapFilteredPeople_publisher_; 00053 iri_perception_msgs::detectionArray detectionArray_msg_; 00054 00055 // [subscriber attributes] 00056 ros::Subscriber map_subscriber_; 00057 void map_callback(const nav_msgs::OccupancyGrid::ConstPtr& msg); 00058 CMutex map_mutex_; 00059 ros::Subscriber people_subscriber_; 00060 void people_callback(const iri_perception_msgs::detectionArray::ConstPtr& msg); 00061 CMutex people_mutex_; 00062 00063 // [service attributes] 00064 00065 // [client attributes] 00066 00067 // [action server attributes] 00068 00069 // [action client attributes] 00070 00071 tf::TransformListener tf_listener_; 00072 00073 nav_msgs::OccupancyGrid map; 00074 iri_perception_msgs::detectionArray peopleIn; 00075 iri_perception_msgs::detectionArray people; 00076 bool mapReceived; 00077 bool peopleReceived; 00078 double neighborRadius; 00079 00080 double markerWidth; 00081 double markerHeight; 00082 double markerR; 00083 double markerG; 00084 double markerB; 00085 double markerA; 00086 00087 std::string frame; 00088 00089 bool checkCellNearObstacle(int index, int neighborDistance); 00090 void getPeopleMarkers(iri_perception_msgs::detectionArray & peopleList, visualization_msgs::MarkerArray & people); 00091 00092 public: 00099 LaserPeopleMapFilterAlgNode(void); 00100 00107 ~LaserPeopleMapFilterAlgNode(void); 00108 00109 protected: 00122 void mainNodeThread(void); 00123 00136 void node_config_update(Config &config, uint32_t level); 00137 00144 void addNodeDiagnostics(void); 00145 00146 // [diagnostic functions] 00147 00148 // [test functions] 00149 }; 00150 00151 #endif