00001 00002 00003 #include "ros/ros.h" 00004 00005 // services 00006 #include <srs_body_detector/getBodyDetections.h> 00007 00008 00009 class BodyDetector { 00010 00011 public: 00012 ros::NodeHandle nh_; 00013 // services 00014 ros::ServiceServer service_server_detect_bodies_; 00015 00016 //constructor 00017 BodyDetector(ros::NodeHandle nh) : 00018 nh_(nh) 00019 { 00020 00021 //services 00022 service_server_detect_bodies_ = nh_.advertiseService("detect_bodies", &BodyDetector::detectBodiesCallback, this); 00023 00024 00025 } 00026 00027 00028 00029 00030 // calback for the DetectLegs service 00031 bool detectBodiesCallback(srs_body_detector::getBodyDetections::Request &req, srs_body_detector::getBodyDetections::Response &res) 00032 { 00033 00034 00035 geometry_msgs::Pose pt1,pt2,pt3,pt4; 00036 00037 pt1.position.x=2.0; pt1.position.y=2.0; 00038 pt2.position.x=-2.0; pt2.position.y=2.0; 00039 pt3.position.x=2.0; pt3.position.y=-2.0; 00040 pt4.position.x=-2.0; pt4.position.y=-2.0; 00041 00042 //res.leg_list.points = detected_legs; 00043 res.bodies_list.push_back(pt1); 00044 res.bodies_list.push_back(pt2); 00045 res.bodies_list.push_back(pt3); 00046 res.bodies_list.push_back(pt4); 00047 00048 return true; 00049 } 00050 00051 00052 }; 00053 00054 00055 00056 int main(int argc, char **argv) 00057 { 00058 ros::init(argc, argv, "srs_body_detector"); 00059 ros::NodeHandle nh; 00060 00061 BodyDetector bd(nh); 00062 00063 ros::spin(); 00064 00065 return 0; 00066 }