finger_action_client.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 import roslib; roslib.load_manifest('jaco_driver')
00004 import rospy
00005 
00006 import actionlib
00007 
00008 import jaco_driver.msg
00009 
00010 import sys
00011 
00012 
00013 def pose_client():
00014     client = actionlib.SimpleActionClient('/jaco/finger_joint_angles', jaco_driver.msg.SetFingersPositionAction)
00015 
00016     goal = jaco_driver.msg.SetFingersPositionGoal()
00017 
00018     if len(sys.argv) < 4:
00019         goal.fingers.Finger_1 = 40.0 
00020         goal.fingers.Finger_2 = 40.0
00021         goal.fingers.Finger_3 = 40.0
00022 
00023         rospy.logwarn("Using test goal: \n%s", goal)
00024     else:
00025         goal.fingers.Finger_1 = float(sys.argv[1])
00026         goal.fingers.Finger_2 = float(sys.argv[2])
00027         goal.fingers.Finger_3 = 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         


jaco_driver
Author(s): Jeff Schmidt (Clearpath), Alex Bencz (Clearpath), Matt DeDonato (WPI)
autogenerated on Mon Jan 6 2014 11:23:43