00001 #! /usr/bin/env python 00002 import roslib; roslib.load_manifest('cob_grasp_generation') 00003 import rospy 00004 00005 import actionlib 00006 import moveit_msgs.msg 00007 import cob_grasp_generation.msg 00008 00009 def query_grasps_client(): 00010 client = actionlib.SimpleActionClient('query_grasps', cob_grasp_generation.msg.QueryGraspsAction) 00011 client.wait_for_server() 00012 00013 goal = cob_grasp_generation.msg.QueryGraspsGoal() 00014 goal.object_name="peanuts" 00015 goal.grasp_id = 0 00016 goal.num_grasps = 0 00017 goal.threshold = 0 00018 00019 client.send_goal(goal) 00020 client.wait_for_result() 00021 return client.get_result() 00022 00023 if __name__ == '__main__': 00024 try: 00025 rospy.init_node('query_grasps_client') 00026 result = query_grasps_client() 00027 print "Result:" 00028 #print result 00029 print len(result.grasp_list) 00030 except rospy.ROSInterruptException: 00031 print "program interrupted before completion"