00001 // 00002 // Copied from 00003 // http://www.ros.org/wiki/pr2_kinematics/Tutorials/Tutorial%202 00004 // 00005 00006 #include <ros/ros.h> 00007 #include <kinematics_msgs/GetKinematicSolverInfo.h> 00008 int main(int argc, char **argv){ 00009 ros::init (argc, argv, "get_ik_solver_info"); 00010 ros::NodeHandle rh; 00011 ros::service::waitForService("pr2_right_arm_kinematics/get_ik_solver_info"); 00012 ros::ServiceClient query_client = rh.serviceClient<kinematics_msgs::GetKinematicSolverInfo>("pr2_right_arm_kinematics/get_ik_solver_info"); 00013 00014 // define the service messages 00015 kinematics_msgs::GetKinematicSolverInfo::Request request; 00016 kinematics_msgs::GetKinematicSolverInfo::Response response; 00017 00018 if(query_client.call(request,response)) 00019 { 00020 for(unsigned int i=0; i< response.kinematic_solver_info.joint_names.size(); i++) 00021 { 00022 ROS_INFO("Joint: %d %s",i,response.kinematic_solver_info.joint_names[i].c_str()); 00023 } 00024 } 00025 else 00026 { 00027 ROS_ERROR("Could not call query service"); 00028 } 00029 ros::shutdown(); 00030 } 00031 00032 00033