00001 #include "ros/ros.h" 00002 #include <tidyup_msgs/DetectGraspableObjects.h> 00003 #include <cstdlib> 00004 00005 int main(int argc, char **argv) { 00006 ros::init(argc, argv, "locate_objects_client"); 00007 00008 ros::NodeHandle n; 00009 ros::ServiceClient client = n.serviceClient< 00010 tidyup_msgs::DetectGraspableObjects>( 00011 "/tidyup/request_graspable_objects"); 00012 tidyup_msgs::DetectGraspableObjects srv; 00013 00014 if (client.call(srv)) { 00015 for (size_t i = 0; i < srv.response.objects.size(); i++) { 00016 ROS_INFO( 00017 "Pose %ld: x = %lf, y = %lf, z = %lf.", i, srv.response.objects[i].pose.pose.position.x, srv.response.objects[i].pose.pose.position.y, srv.response.objects[i].pose.pose.position.z); 00018 } 00019 } else { 00020 ROS_ERROR("Failed to call service locate_objects"); 00021 return 1; 00022 } 00023 00024 return 0; 00025 }