cob_monitor_arm_client.py
Go to the documentation of this file.
00001 #! /usr/bin/env python
00002 
00003 import roslib; roslib.load_manifest('cob_lookat_action')
00004 import rospy
00005 import random
00006 
00007 # Brings in the SimpleActionClient
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     # Creates the SimpleActionClient, passing the type of the action
00017     # (FibonacciAction) to the constructor.
00018     client = actionlib.SimpleActionClient('lookat_action', cob_lookat_action.msg.LookAtAction)
00019     
00020     focus_pub = rospy.Publisher('/lookat_target', PoseStamped)
00021 
00022     # Waits until the action server has started up and started
00023     # listening for goals.
00024     client.wait_for_server()
00025 
00026     # Creates a goal to send to the action server.
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     #print "GOAL: ", goal
00034     
00035     while not rospy.is_shutdown():
00036         #client.cancel_goal()
00037         
00038         focus.header.stamp = rospy.Time.now()
00039     
00040         ##Debug
00041         #focus_pub.publish(goal.target)
00042         #rospy.sleep(2.0)
00043      
00044         # Sends the goal to the action server.
00045         client.send_goal(goal)
00046         
00047         #rospy.sleep(0.1)
00048 
00049 
00050     # Waits for the server to finish performing the action.
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         # Initializes a rospy node so that the SimpleActionClient can
00061         # publish and subscribe over ROS.
00062         rospy.init_node('cob_lookat_action_client')
00063         result = cob_lookat_action_client()
00064     except rospy.ROSInterruptException:
00065         print "program interrupted before completion"


cob_lookat_action
Author(s): Felix Messmer
autogenerated on Wed Aug 26 2015 11:01:21