00001
00002
00003 import rospy
00004 from sr_robot_commander.sr_hand_commander import SrHandCommander
00005
00006
00007 rospy.init_node("store_left_hand", anonymous=True)
00008
00009 hand_commander = SrHandCommander(name="left_hand", prefix="lh")
00010
00011 open_hand = {'lh_FFJ1': 0.0, 'lh_FFJ2': 0.0, 'lh_FFJ3': 0.0, 'lh_FFJ4': 0.0,
00012 'lh_MFJ1': 0.0, 'lh_MFJ2': 0.0, 'lh_MFJ3': 0.0, 'lh_MFJ4': 0.0,
00013 'lh_RFJ1': 0.0, 'lh_RFJ2': 0.0, 'lh_RFJ3': 0.0, 'lh_RFJ4': 0.0,
00014 'lh_LFJ1': 0.0, 'lh_LFJ2': 0.0, 'lh_LFJ3': 0.0, 'lh_LFJ4': 0.0, 'lh_LFJ5': 0.0,
00015 'lh_THJ1': 0.0, 'lh_THJ2': 0.0, 'lh_THJ3': 0.0, 'lh_THJ4': 0.0, 'lh_THJ5': 0.0,
00016 'lh_WRJ1': 0.0, 'lh_WRJ2': 0.0}
00017 pack_hand = {'lh_FFJ1': 1.5707, 'lh_FFJ2': 1.5707, 'lh_FFJ3': 1.5707, 'lh_FFJ4': 0.0,
00018 'lh_MFJ1': 1.5707, 'lh_MFJ2': 1.5707, 'lh_MFJ3': 1.5707, 'lh_MFJ4': 0.0,
00019 'lh_RFJ1': 1.5707, 'lh_RFJ2': 1.5707, 'lh_RFJ3': 1.5707, 'lh_RFJ4': 0.0,
00020 'lh_LFJ1': 1.5707, 'lh_LFJ2': 1.5707, 'lh_LFJ3': 1.5707, 'lh_LFJ4': 0.0, 'lh_LFJ5': 0.0,
00021 'lh_THJ1': 0.35, 'lh_THJ2': 0.58, 'lh_THJ3': 0.0, 'lh_THJ4': 0.39, 'lh_THJ5': 0.25,
00022 'lh_WRJ1': 0.0, 'lh_WRJ2': 0.0}
00023
00024
00025 joint_states = open_hand
00026 rospy.loginfo("Moving hand to joint states\n" + str(joint_states) + "\n")
00027 hand_commander.move_to_joint_value_target_unsafe(joint_states, 1.0, False)
00028 rospy.sleep(2)
00029
00030
00031 joint_states = pack_hand
00032 rospy.loginfo("Moving hand to joint states\n" + str(joint_states) + "\n")
00033 hand_commander.move_to_joint_value_target_unsafe(joint_states, 3.0, True)
00034 rospy.sleep(2)