show_grasps_rviz_client.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 #
00003 # Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
00004 #
00005 # Licensed under the Apache License, Version 2.0 (the "License");
00006 # you may not use this file except in compliance with the License.
00007 # You may obtain a copy of the License at
00008 #
00009 #   http://www.apache.org/licenses/LICENSE-2.0
00010 #
00011 # Unless required by applicable law or agreed to in writing, software
00012 # distributed under the License is distributed on an "AS IS" BASIS,
00013 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014 # See the License for the specific language governing permissions and
00015 # limitations under the License.
00016 
00017 
00018 import rospy
00019 
00020 import actionlib
00021 import cob_grasp_generation.msg
00022 
00023 def show_grasps_client():
00024     client = actionlib.SimpleActionClient('show_grasps_rviz', cob_grasp_generation.msg.ShowGraspsAction)
00025     client.wait_for_server()
00026 
00027     object_name = raw_input("Insert object name: ")
00028     gripper_type = raw_input("Insert gripper_type: ")
00029     gripper_side = ""
00030     grasp_id = 0
00031 
00032     while not rospy.is_shutdown():
00033         print grasp_id
00034 
00035         # Set the goal here: object_name, grasp_id, sort-by-quality
00036         goal = cob_grasp_generation.msg.ShowGraspsGoal(object_name, gripper_type, gripper_side, grasp_id, True)
00037 
00038         client.send_goal(goal)
00039         client.wait_for_result()
00040         success = client.get_result().success
00041         if not success:
00042             break
00043 
00044         raw_input("Enter for next grasp...")
00045         grasp_id = grasp_id + 1
00046     
00047     print "no more grasps"
00048 
00049 
00050 if __name__ == '__main__':
00051     try:
00052         rospy.init_node('show_grasp_client')
00053         result = show_grasps_client()
00054     except rospy.ROSInterruptException:
00055         print "program interrupted before completion"


cob_grasp_generation
Author(s): Witalij Siebert, Felix Messmer
autogenerated on Thu Jun 6 2019 21:22:47