Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 import roslib; roslib.load_manifest('rosie_pr2_gripper_action')
00022 import rospy
00023 
00024 from actionlib_msgs.msg import *
00025 from pr2_controllers_msgs.msg import *
00026 import actionlib
00027 
00028 
00029 def gripper_command(client, position):
00030     goal = Pr2GripperCommandGoal()
00031     goal.command.position = position
00032     goal.command.max_effort = 0.5
00033     client.send_goal(goal)
00034     client.wait_for_result(rospy.Duration(20.0))  
00035         
00036 def main():
00037     rospy.loginfo("test_pr2_gripper_action: Starting up!")
00038     rospy.init_node('test_pr2_gripper_action')
00039 
00040     
00041     l_client = actionlib.SimpleActionClient('/l_gripper_controller/gripper_action', Pr2GripperCommandAction)
00042     r_client = actionlib.SimpleActionClient('/r_gripper_controller/gripper_action', Pr2GripperCommandAction)
00043 
00044     l_client.wait_for_server(rospy.Duration(20.0))
00045     r_client.wait_for_server(rospy.Duration(20.0))
00046 
00047     print("Left hand:")
00048     print("Closing the fingers.")
00049     gripper_command(l_client, 0.0)
00050     print("Opening the fingers.")
00051     gripper_command(l_client, 0.08)
00052 
00053     print("Right hand:")
00054     print("Closing the fingers.")
00055     gripper_command(r_client, 0.0)
00056     print("Opening the fingers.")
00057     gripper_command(r_client, 0.08)
00058     
00059     
00060 if __name__ == '__main__':
00061     main()