24 from sr_robot_commander.sr_arm_commander
import SrArmCommander
25 from sr_robot_commander.sr_hand_commander
import SrHandCommander
28 rospy.init_node(
"basic_hand_arm_example", anonymous=
True)
30 hand_commander = SrHandCommander(name=
"left_hand", prefix=
"lh")
31 arm_commander = SrArmCommander(name=
"left_arm", set_ground=
False)
35 rospy.loginfo(
"Set arm teach mode ON")
36 arm_commander.set_teach_mode(
True)
39 rospy.loginfo(
"Set arm teach mode OFF")
40 arm_commander.set_teach_mode(
False)
43 hand_joints_goal_1 = {
'lh_FFJ1': 0.35,
'lh_FFJ2': 0.0,
'lh_FFJ3': 0.0,
'lh_FFJ4': 0.0,
44 'lh_MFJ1': 0.35,
'lh_MFJ2': 0.0,
'lh_MFJ3': 0.0,
'lh_MFJ4': 0.0,
45 'lh_RFJ1': 0.35,
'lh_RFJ2': 0.0,
'lh_RFJ3': 0.0,
'lh_RFJ4': 0.0,
46 'lh_LFJ1': 0.35,
'lh_LFJ2': 0.0,
'lh_LFJ3': 0.0,
'lh_LFJ4': 0.0,
47 'lh_THJ1': 0.35,
'lh_THJ2': 0.0,
'lh_THJ3': 0.0,
'lh_THJ4': 0.0,
'lh_THJ5': 0.0}
49 hand_joints_goal_2 = {
'lh_FFJ1': 0.35,
'lh_FFJ2': 1.5707,
'lh_FFJ3': 1.5707,
'lh_FFJ4': 0.0,
50 'lh_MFJ1': 0.35,
'lh_MFJ2': 1.5707,
'lh_MFJ3': 1.5707,
'lh_MFJ4': 0.0,
51 'lh_RFJ1': 0.35,
'lh_RFJ2': 1.5707,
'lh_RFJ3': 1.5707,
'lh_RFJ4': 0.0,
52 'lh_LFJ1': 0.35,
'lh_LFJ2': 1.5707,
'lh_LFJ3': 1.5707,
'lh_LFJ4': 0.0,
53 'lh_THJ1': 0.35,
'lh_THJ2': 0.0,
'lh_THJ3': 0.0,
'lh_THJ4': 0.0,
'lh_THJ5': 0.0}
55 hand_joints_goal_3 = {
'lh_FFJ1': 0.35,
'lh_FFJ2': 0.0,
'lh_FFJ3': 0.0}
57 arm_joints_goal_1 = {
'la_shoulder_pan_joint': 0.43,
'la_elbow_joint': 2.12,
58 'la_wrist_1_joint': -1.71,
'la_wrist_2_joint': 1.48,
59 'la_shoulder_lift_joint': -2.58,
'la_wrist_3_joint': 1.62,
60 'lh_WRJ1': 0.0,
'lh_WRJ2': 0.0}
62 arm_joints_goal_2 = {
'la_shoulder_pan_joint': 0.42,
'la_elbow_joint': 1.97,
63 'la_wrist_1_joint': -0.89,
'la_wrist_2_joint': -0.92,
64 'la_shoulder_lift_joint': -1.93,
'la_wrist_3_joint': 0.71,
65 'lh_WRJ1': 0.0,
'lh_WRJ2': 0.0}
72 joint_goals = hand_joints_goal_1
73 rospy.loginfo(
"Moving hand to joint states\n" + str(joint_goals) +
"\n")
74 hand_commander.move_to_joint_value_target_unsafe(joint_goals, 1.0,
False)
77 joint_goals = arm_joints_goal_1
78 rospy.loginfo(
"Moving arm to joint states\n" + str(joint_goals) +
"\n")
79 arm_commander.move_to_joint_value_target_unsafe(joint_goals, 3.0,
True)
83 joint_goals = hand_joints_goal_2
84 rospy.loginfo(
"Moving hand to joint states\n" + str(joint_goals) +
"\n")
85 hand_commander.move_to_joint_value_target_unsafe(joint_goals, 3.0,
True)
89 joint_goals = hand_joints_goal_3
90 rospy.loginfo(
"Moving hand to joint states\n" + str(joint_goals) +
"\n")
91 hand_commander.move_to_joint_value_target_unsafe(joint_goals, 3.0,
False)
94 joint_goals = arm_joints_goal_2
95 rospy.loginfo(
"Moving arm to joint states\n" + str(joint_goals) +
"\n")
96 arm_commander.move_to_joint_value_target_unsafe(joint_goals, 3.0,
True)
99 hand_commander.set_teach_mode(
True)
102 rospy.loginfo(
"Set hand teach mode OFF")
103 hand_commander.set_teach_mode(
False)