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 _people_simulation_alg_node_h_ 00026 #define _people_simulation_alg_node_h_ 00027 00028 #include <iri_base_algorithm/iri_base_algorithm.h> 00029 #include "people_simulation_alg.h" 00030 #include "scene_sim.h" 00031 00032 // [publisher subscriber headers] 00033 #include <visualization_msgs/MarkerArray.h> 00034 #include <geometry_msgs/PoseStamped.h> 00035 #include <iri_perception_msgs/peopleTrackingArray.h> 00036 00037 // [service client headers] 00038 #include <std_srvs/Empty.h> 00039 00040 // [action server client headers] 00041 00046 class PeopleSimulationAlgNode : public algorithm_base::IriBaseAlgorithm<PeopleSimulationAlgorithm> 00047 { 00048 enum simulation_mode {Normal=0, Density_incremental }; 00049 private: 00050 // [publisher attributes] 00051 ros::Publisher tracksMarkers_publisher_; 00052 visualization_msgs::MarkerArray MarkerArray_msg_; 00053 visualization_msgs::Marker track_marker_,id_marker_; 00054 00055 ros::Publisher tracks_publisher_; 00056 iri_perception_msgs::peopleTrackingArray peopleTrackingArray_msg_; 00057 00058 // [subscriber attributes] 00059 ros::Subscriber robot_pose_subscriber_; 00060 void robot_pose_callback(const geometry_msgs::PoseStamped::ConstPtr& msg); 00061 CMutex robot_pose_mutex_; 00062 00063 // [service attributes] 00064 ros::ServiceServer reset_server_; 00065 bool resetCallback(std_srvs::Empty::Request &req, std_srvs::Empty::Response &res); 00066 CMutex reset_mutex_; 00067 00068 // [client attributes] 00069 00070 // [action server attributes] 00071 00072 // [action client attributes] 00073 00074 // [class atributes] 00075 int n_persons_; 00076 simulation_mode simulation_mode_; 00077 Cscene_sim scene_; 00078 void init_sim(); 00079 std::string force_map_path_, destination_map_path_; 00080 bool vis_mode_,remove_targets_; 00081 00082 public: 00089 PeopleSimulationAlgNode(void); 00090 00097 ~PeopleSimulationAlgNode(void); 00098 00099 protected: 00112 void mainNodeThread(void); 00113 00126 void node_config_update(Config &config, uint32_t level); 00127 00134 void addNodeDiagnostics(void); 00135 00136 // [diagnostic functions] 00137 00138 // [test functions] 00139 }; 00140 00141 #endif