cob_lookat_action_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 random
00019 
00020 import rospy
00021 import actionlib
00022 
00023 import cob_lookat_action.msg
00024 
00025 def cob_lookat_action_client():
00026     client = actionlib.SimpleActionClient('lookat_action', cob_lookat_action.msg.LookAtAction)
00027     print "Waiting for Server..."
00028     client.wait_for_server()
00029     print "...done!"
00030 
00031     # Creates a goal to send to the action server.
00032     goal = cob_lookat_action.msg.LookAtGoal()
00033     goal.target_frame = "lookat_target"
00034     goal.pointing_frame = "sensorring_base_link"
00035     goal.pointing_axis_type = 0   # X_POSITIVE
00036     #print "GOAL: ", goal
00037 
00038     # Sends the goal to the action server.
00039     client.send_goal(goal)
00040 
00041     # Waits for the server to finish performing the action.
00042     client.wait_for_result()
00043 
00044     result = client.get_result()
00045     print result
00046 
00047     return result.success
00048 
00049 if __name__ == '__main__':
00050     try:
00051         rospy.init_node('cob_lookat_action_client')
00052         result = cob_lookat_action_client()
00053     except rospy.ROSInterruptException:
00054         print "program interrupted before completion"


cob_lookat_action
Author(s): Felix Messmer
autogenerated on Thu Jun 6 2019 21:22:57