00001
00002
00003 import rospy
00004 from sr_robot_commander.sr_hand_commander import SrHandCommander
00005
00006
00007 rospy.init_node("basic_left_examples", anonymous=True)
00008
00009 hand_commander = SrHandCommander(name="left_hand", prefix="lh")
00010
00011 hand_joint_states_1 = {'lh_FFJ1': 0.35, 'lh_FFJ2': 0.0, 'lh_FFJ3': 0.0, 'lh_FFJ4': 0.0,
00012 'lh_MFJ1': 0.35, 'lh_MFJ2': 0.0, 'lh_MFJ3': 0.0, 'lh_MFJ4': 0.0,
00013 'lh_RFJ1': 0.35, 'lh_RFJ2': 0.0, 'lh_RFJ3': 0.0, 'lh_RFJ4': 0.0,
00014 'lh_LFJ1': 0.35, 'lh_LFJ2': 0.0, 'lh_LFJ3': 0.0, 'lh_LFJ4': 0.0,
00015 'lh_THJ1': 0.35, '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 hand_joint_states_2 = {'lh_FFJ1': 0.35, 'lh_FFJ2': 1.5707, 'lh_FFJ3': 1.5707, 'lh_FFJ4': 0.0,
00018 'lh_MFJ1': 0.35, 'lh_MFJ2': 1.5707, 'lh_MFJ3': 1.5707, 'lh_MFJ4': 0.0,
00019 'lh_RFJ1': 0.35, 'lh_RFJ2': 1.5707, 'lh_RFJ3': 1.5707, 'lh_RFJ4': 0.0,
00020 'lh_LFJ1': 0.35, 'lh_LFJ2': 1.5707, 'lh_LFJ3': 1.5707, 'lh_LFJ4': 0.0,
00021 'lh_THJ1': 0.35, 'lh_THJ2': 0.0, 'lh_THJ3': 0.0, 'lh_THJ4': 0.0, 'lh_THJ5': 0.0,
00022 'lh_WRJ1': 0.0, 'lh_WRJ2': 0.0}
00023 hand_joint_states_3 = {'lh_FFJ1': 0.35, 'lh_FFJ2': 0.0, 'lh_FFJ3': 0.0}
00024
00025
00026 joint_states = hand_joint_states_1
00027 rospy.loginfo("Moving hand to joint states\n" + str(joint_states) + "\n")
00028 hand_commander.move_to_joint_value_target_unsafe(joint_states, 1.0, False)
00029 rospy.sleep(1)
00030
00031
00032 joint_states = hand_joint_states_2
00033 rospy.loginfo("Moving hand to joint states\n" + str(joint_states) + "\n")
00034 hand_commander.move_to_joint_value_target_unsafe(joint_states, 3.0, True)
00035 rospy.sleep(1)
00036
00037
00038 joint_states = hand_joint_states_3
00039 rospy.loginfo("Moving hand to joint states\n" + str(joint_states) + "\n")
00040 hand_commander.move_to_joint_value_target_unsafe(joint_states, 3.0, False)
00041 rospy.sleep(1)