00001 00034 #include <ros/ros.h> 00035 #include <cob_arm_navigation/HandleObject.h> 00036 00037 #include <string> 00038 00039 int main(int argc, char **argv) 00040 { 00041 ros::init(argc, argv, "test_object_handler"); 00042 if (argc != 2) 00043 { 00044 ROS_INFO("usage: test_object_handler <object_name>"); 00045 return 1; 00046 } 00047 00048 ros::NodeHandle n; 00049 00050 ros::service::waitForService("object_handler/add_object"); 00051 ros::ServiceClient client = n.serviceClient<cob_arm_navigation::HandleObject>("object_handler/add_object"); 00052 cob_arm_navigation::HandleObject::Request req; 00053 cob_arm_navigation::HandleObject::Response res; 00054 req.object.data = argv[1]; 00055 00056 if (client.call(req, res)) 00057 { 00058 ROS_INFO("Result: %s", res.error_message.data.c_str()); 00059 } 00060 else 00061 { 00062 ROS_ERROR("Failed to call service"); 00063 return 1; 00064 } 00065 00066 return 0; 00067 }