Go to the documentation of this file.00001
00002
00003 import roslib; roslib.load_manifest('cob_lookat_action')
00004 import rospy
00005 import random
00006
00007
00008 import actionlib
00009
00010 import cob_lookat_action.msg
00011 from geometry_msgs.msg import PoseStamped
00012 from moveit_msgs.srv import *
00013 from moveit_msgs.msg import *
00014
00015 def cob_lookat_action_client():
00016
00017
00018 client = actionlib.SimpleActionClient('lookat_action', cob_lookat_action.msg.LookAtAction)
00019
00020 focus_pub = rospy.Publisher('/lookat_target', PoseStamped)
00021
00022
00023
00024 client.wait_for_server()
00025
00026
00027 goal = cob_lookat_action.msg.LookAtGoal()
00028 focus = PoseStamped()
00029 focus.header.stamp = rospy.Time.now()
00030 focus.header.frame_id = "arm_7_link"
00031 focus.pose.orientation.w = 1.0
00032 goal.target = focus
00033
00034
00035 while not rospy.is_shutdown():
00036
00037
00038 focus.header.stamp = rospy.Time.now()
00039
00040
00041
00042
00043
00044
00045 client.send_goal(goal)
00046
00047
00048
00049
00050
00051 client.wait_for_result()
00052
00053 result = client.get_result()
00054 print result
00055
00056 return result.success
00057
00058 if __name__ == '__main__':
00059 try:
00060
00061
00062 rospy.init_node('cob_lookat_action_client')
00063 result = cob_lookat_action_client()
00064 except rospy.ROSInterruptException:
00065 print "program interrupted before completion"