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 _iri_people_tracking_alg_node_h_ 00026 #define _iri_people_tracking_alg_node_h_ 00027 00028 #include <tf/tfMessage.h> 00029 #include <tf/transform_broadcaster.h> 00030 #include <iri_base_algorithm/iri_base_algorithm.h> 00031 #include "iri_people_tracking_alg.h" 00032 00033 // [publisher subscriber headers] 00034 #include <iri_perception_msgs/detectionArray.h> 00035 #include <iri_perception_msgs/peopleTrackingArray.h> 00036 #include <nav_msgs/Odometry.h> 00037 #include <visualization_msgs/MarkerArray.h> 00038 00039 // [service client headers] 00040 00041 // [action server client headers] 00042 #include <iri_action_server/iri_action_server.h> 00043 #include <iri_perception_msgs/peopleTrackAction.h> 00044 00045 //library includes 00046 #include "peopleTracker.h" 00047 00052 class IriPeopleTrackingAlgNode : public algorithm_base::IriBaseAlgorithm<IriPeopleTrackingAlgorithm> 00053 { 00054 private: 00055 // [publisher attributes] 00056 ros::Publisher peopleSet_publisher_; 00057 iri_perception_msgs::peopleTrackingArray peopleTrackingArray_msg_; 00058 ros::Publisher particleSet_publisher_; 00059 visualization_msgs::MarkerArray MarkerArray_msg_; 00060 00061 // [subscriber attributes] 00062 ros::Subscriber people_detection_subscriber_; 00063 void people_detection_callback(const iri_perception_msgs::detectionArray::ConstPtr& msg); 00064 CMutex people_detection_mutex_; 00065 ros::Subscriber platformOdometry_subscriber_; 00066 void platformOdometry_callback(const nav_msgs::Odometry::ConstPtr& msg); 00067 CMutex platformOdometry_mutex_; 00068 00069 // [service attributes] 00070 00071 // [client attributes] 00072 00073 // [action server attributes] 00074 IriActionServer<iri_perception_msgs::peopleTrackAction> people_tracking_aserver_; 00075 void people_trackingStartCallback(const iri_perception_msgs::peopleTrackGoalConstPtr& goal); 00076 void people_trackingStopCallback(void); 00077 bool people_trackingIsFinishedCallback(void); 00078 bool people_trackingHasSucceedCallback(void); 00079 void people_trackingGetResultCallback(iri_perception_msgs::peopleTrackResultPtr& result); 00080 void people_trackingGetFeedbackCallback(iri_perception_msgs::peopleTrackFeedbackPtr& feedback); 00081 00082 // [action client attributes] 00083 00084 //library objects 00085 CpeopleTracker tracker; 00086 CodometryObservation odometry; 00087 std::string people_detector_frame_id_; 00088 ros::Time people_detector_stamp_; 00089 00090 void fillTopicMsgs(std::list<CpeopleTrackingObservation> & peopleList); 00091 00092 00093 double markerSize; 00094 double markerR; 00095 double markerG; 00096 double markerB; 00097 00098 public: 00105 IriPeopleTrackingAlgNode(void); 00106 00113 ~IriPeopleTrackingAlgNode(void); 00114 00115 protected: 00128 void mainNodeThread(void); 00129 00142 void node_config_update(Config &config, uint32_t level); 00143 00150 void addNodeDiagnostics(void); 00151 00152 // [diagnostic functions] 00153 00154 // [test functions] 00155 }; 00156 00157 #endif