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 import simple_moveit_interface as smi 00020 00021 #Requirements: 00022 #- latest cob_bringup layer with lookat_component 00023 #- sensor input for moveit enabled? 00024 #- robot facing a wall in the background 00025 #- lookat_action server and monitor started? 00026 #- lookat works for both arm positions? 00027 # 00028 #- These positions currently are cob3-3 specific 00029 00030 00031 if __name__ == '__main__': 00032 rospy.init_node('move_example') 00033 00034 smi.add_ground() 00035 rospy.sleep(1.0) 00036 00037 #while rospy.get_time() == 0.0: pass 00038 rospy.logerr('Are you using cob3-3? Did you make sure all requirements are met? Read the code file!') 00039 ans = raw_input('[y/n] ') 00040 if ans == 'y': 00041 while not rospy.is_shutdown(): 00042 print "Going Left" 00043 success = smi.moveit_joint_goal("arm", [0.6132456177400849, -1.2667904686872227, -1.3351177346743512, 0.623757247043325, 2.6443916288424734, 0.2923237627622837, -2.121120037112681], True) 00044 #success = smi.moveit_joint_goal("arm", [0.4474927123777702, -1.4042363503909014, -1.3427710033793065, 0.8556133802524375, 2.8670612914249532, 0.2447635934094972, -1.8559613290891581], True) 00045 print "Going Right" 00046 success = smi.moveit_joint_goal("arm", [-0.4429381361070571, -2.027464518329273, 0.5376498408783335, -0.07512923290336566, -0.5249117648804152, 0.4386535797226253, -0.7085319372561121], True) 00047 #success = smi.moveit_joint_goal("arm", [-0.2875421191578158, -1.8672004116184473, 0.5368099709961187, -0.07435202034076506, -0.523647727633693, 0.43781158053874125, -0.709280142446791], True) 00048 elif ans == 'n': 00049 rospy.logerr('Please activate it!') 00050 00051