Go to the documentation of this file.00001
00002
00003 import roslib; roslib.load_manifest('jaco_msgs')
00004 import rospy
00005
00006 import actionlib
00007
00008 import jaco_msgs.msg
00009
00010 import sys
00011
00012
00013 def pose_client():
00014 client = actionlib.SimpleActionClient('/jaco/finger_joint_angles', jaco_msgs.msg.SetFingersPositionAction)
00015
00016 goal = jaco_msgs.msg.SetFingersPositionGoal()
00017
00018 if len(sys.argv) < 4:
00019 goal.fingers.finger1 = 4000
00020 goal.fingers.finger2 = 4000
00021 goal.fingers.finger3 = 4000
00022
00023 rospy.logwarn("Using test goal: \n%s", goal)
00024 else:
00025 goal.fingers.finger1 = float(sys.argv[1])
00026 goal.fingers.finger2 = float(sys.argv[2])
00027 goal.fingers.finger3 = float(sys.argv[3])
00028
00029 client.wait_for_server()
00030 rospy.loginfo("Connected to Finger server")
00031
00032 client.send_goal(goal)
00033
00034 try:
00035 client.wait_for_result()
00036 except KeyboardInterrupt:
00037 rospy.loginfo("Program interrupted, pre-empting goal")
00038 client.cancel_all_goals()
00039
00040 return client.get_result()
00041
00042 if __name__ == '__main__':
00043 try:
00044 rospy.init_node('finger_pose_client')
00045 result = pose_client()
00046 rospy.loginfo("Result: \n%s", result)
00047 except rospy.ROSInterruptException:
00048 rospy.loginfo("Program interrupted before completion")
00049