00001 /************************************************************************************************** 00002 Software License Agreement (BSD License) 00003 00004 Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt 00005 All rights reserved. 00006 00007 Redistribution and use in source and binary forms, with or without modification, are permitted 00008 provided that the following conditions are met: 00009 00010 *Redistributions of source code must retain the above copyright notice, this list of 00011 conditions and the following disclaimer. 00012 *Redistributions in binary form must reproduce the above copyright notice, this list of 00013 conditions and the following disclaimer in the documentation and/or other materials provided 00014 with the distribution. 00015 *Neither the name of the University of Aveiro nor the names of its contributors may be used to 00016 endorse or promote products derived from this software without specific prior written permission. 00017 00018 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 00019 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 00020 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 00021 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00022 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00023 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 00024 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00025 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 ***************************************************************************************************/ 00027 #ifndef HUMAN_PROC_H 00028 #define HUMAN_PROC_H 00029 00030 #include <ros/ros.h> 00031 #include <tf/transform_broadcaster.h> 00032 #include <tf/transform_listener.h> 00033 00034 #include <ar_pose/ARMarkers.h> 00035 #include <ar_pose/ARMarker.h> 00036 // #include <ar_pose/object.h> 00037 00038 #include "std_msgs/String.h" 00039 00040 //#include "social_filter/humanPose.h" //this is for the msg defined 00041 //#include "social_filter/humanPoses.h" 00042 00043 // #include "trajectory_simulator/TrajectoryObservation.h" 00044 #include "leader_follower/TrajectoryObservation.h" 00045 00046 //social_filter::humanPose ped; 00047 //social_filter::humanPoses list_ped; 00048 // trajectory_simulator::TrajectoryObservation ghmm_wrapper; 00049 ros::Publisher trajectory_pub; 00050 int marker_id, marker_type; 00051 ros::Duration duration_since_detection; 00052 int list_size = 10; 00053 00054 struct ar_management{ 00055 // int type; 00056 ros::Time detect_time; 00057 trajectory_simulator::TrajectoryObservation ghmm_wrapper; 00058 }; 00059 00060 ar_management markers_list[10]; 00061 00062 void manage_list(int marker_id); 00063 00064 double euclidean_dist(double x1,double y1,double x2, double y2){ 00065 double dist2 = ((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2)); 00066 return (sqrt(dist2)); 00067 } 00068 00069 class ar_pose_reader 00070 { 00071 public: 00072 ar_pose_reader(std_msgs::String topic_name, ros::NodeHandle* n); 00073 // void ar_pose_callback(const ar_pose::ARMarkers::ConstPtr&);//for single marker 00074 void ar_pose_callback(const ar_pose::ARMarkers::ConstPtr&); //for multi markers 00075 void init(); 00076 social_filter::humanPose getPose(); 00077 ros::NodeHandle *local_n; 00078 ros::Subscriber ar_pose_sub; 00079 //social_filter::humanPose local_ped; 00080 std_msgs::String name; 00081 int num_markers; 00082 00083 tf::TransformListener listener; 00084 geometry_msgs::PoseStamped source_pose; 00085 geometry_msgs::PoseStamped target_pose; 00086 }; 00087 00088 class ar_humanProc 00089 { 00090 public: 00091 00092 ar_humanProc(); 00093 ~ar_humanProc(); 00094 void init(); 00095 void pub(); 00096 // void broadcast(); 00097 std::vector<double> vec_x; 00098 std::vector<double> vec_y; 00099 std::vector<double> vec_theta; 00100 std::vector<ar_pose_reader*> readers; 00101 00102 protected: 00103 ros::NodeHandle n; 00104 ros::Publisher pose_pub; 00105 // social_filter::humanPose ped; 00106 // social_filter::humanPoses list_ped; 00107 // ar_pose::ARMarker ar_pose_msg; //for single marker 00108 ar_pose::ARMarkers ar_pose_msg; //for multi markers 00109 unsigned int init_index; 00110 unsigned int NoH; 00111 }; 00112 00113 00114 #endif // HUMAN_PROC_H 00115