34 from sr_robot_commander.sr_arm_commander
import SrArmCommander
35 from sr_robot_commander.sr_hand_commander
import SrHandCommander
37 rospy.init_node(
"basic_arm_examples", anonymous=
True)
39 hand_commander = SrHandCommander(name=
"left_hand", prefix=
"lh")
40 arm_commander = SrArmCommander(name=
"left_arm", set_ground=
False)
43 hand_joint_goals_1 = {
'lh_RFJ2': 1.59,
'lh_RFJ3': 1.49,
'lh_RFJ1': 1.47,
'lh_RFJ4': -0.01,
'lh_LFJ4': 0.02,
44 'lh_LFJ5': 0.061,
'lh_LFJ1': 1.41,
'lh_LFJ2': 1.60,
'lh_LFJ3': 1.49,
'lh_THJ2': 0.64,
45 'lh_THJ3': -0.088,
'lh_THJ1': 0.43,
'lh_THJ4': 0.49,
'lh_THJ5': 0.35,
'lh_FFJ4': -0.02,
46 'lh_FFJ2': 1.71,
'lh_FFJ3': 1.49,
'lh_FFJ1': 1.25,
'lh_MFJ3': 1.49,
'lh_MFJ2': 1.66,
47 'lh_MFJ1': 1.31,
'lh_MFJ4': -0.02}
49 hand_joint_goals_2 = {
'lh_RFJ2': 0.55,
'lh_RFJ3': 0.08,
'lh_RFJ1': 0.03,
'lh_RFJ4': -0.15,
'lh_LFJ4': -0.35,
50 'lh_LFJ5': 0.23,
'lh_LFJ1': 0.02,
'lh_LFJ2': 0.49,
'lh_LFJ3': -0.02,
'lh_THJ2': -0.08,
51 'lh_THJ3': -0.08,
'lh_THJ1': 0.15,
'lh_THJ4': 0.56,
'lh_THJ5': -0.17,
'lh_FFJ4': -0.34,
52 'lh_FFJ2': 0.30,
'lh_FFJ3': 0.16,
'lh_FFJ1': 0.01,
'lh_MFJ3': 0.19,
'lh_MFJ2': 0.50,
53 'lh_MFJ1': 0.00,
'lh_MFJ4': -0.07}
55 hand_joint_goals_3 = {
'lh_RFJ2': 0.63,
'lh_RFJ3': 0.77,
'lh_RFJ1': 0.033,
'lh_RFJ4': -0.02,
'lh_LFJ4': -0.32,
56 'lh_LFJ5': 0.67,
'lh_LFJ1': 0.02,
'lh_LFJ2': 0.73,
'lh_LFJ3': 0.21,
'lh_THJ2': -0.06,
57 'lh_THJ3': -0.04,
'lh_THJ1': 0.39,
'lh_THJ4': 0.85,
'lh_THJ5': 0.40,
'lh_FFJ4': -0.35,
58 'lh_FFJ2': 0.90,
'lh_FFJ3': 0.56,
'lh_FFJ1': 0.02,
'lh_MFJ3': 0.59,
'lh_MFJ2': 0.84,
59 'lh_MFJ1': 0.05,
'lh_MFJ4': -0.08}
61 hand_joint_goals_4 = {
'lh_RFJ2': 0.57,
'lh_RFJ3': 0.27,
'lh_RFJ1': 0.04,
'lh_RFJ4': -0.01,
'lh_LFJ4': -0.28,
62 'lh_LFJ5': 0.39,
'lh_LFJ1': 0.01,
'lh_LFJ2': 0.72,
'lh_LFJ3': -0.12,
'lh_THJ2': -0.19,
63 'lh_THJ3': -0.05,
'lh_THJ1': 0.38,
'lh_THJ4': 0.85,
'lh_THJ5': -0.12,
'lh_FFJ4': -0.32,
64 'lh_FFJ2': 0.64,
'lh_FFJ3': -0.03,
'lh_FFJ1': 0.04,
'lh_MFJ3': 0.04,
'lh_MFJ2': 0.83,
65 'lh_MFJ1': 0.01,
'lh_MFJ4': -0.05}
67 hand_joint_goals_5 = {
'lh_RFJ2': 1.58,
'lh_RFJ3': 1.52,
'lh_RFJ1': 1.34,
'lh_RFJ4': -0.06,
'lh_LFJ4': -0.20,
68 'lh_LFJ5': 0.09,
'lh_LFJ1': 1.47,
'lh_LFJ2': 1.57,
'lh_LFJ3': 1.40,
'lh_THJ2': -0.01,
69 'lh_THJ3': -0.041,
'lh_THJ1': 0.29,
'lh_THJ4': 0.59,
'lh_THJ5': -1.36,
'lh_FFJ4': 0.03,
70 'lh_FFJ2': 1.72,
'lh_FFJ3': 1.41,
'lh_FFJ1': 1.21,
'lh_MFJ3': 1.39,
'lh_MFJ2': 1.65,
71 'lh_MFJ1': 1.33,
'lh_MFJ4': 0.12}
73 arm_joint_goals_1 = {
'la_shoulder_lift_joint': -1.87,
'la_elbow_joint': 1.76,
'la_wrist_2_joint': 0.03,
74 'la_wrist_1_joint': -0.86,
'la_shoulder_pan_joint': -2.64,
'la_wrist_3_joint': 0.69,
75 'lh_WRJ2': -0.02,
'lh_WRJ1': 0.03}
77 arm_joint_goals_2 = {
'la_shoulder_lift_joint': -1.86,
'la_elbow_joint': 1.85,
'la_wrist_2_joint': -0.19,
78 'la_wrist_1_joint': -0.96,
'la_shoulder_pan_joint': -1.78,
'la_wrist_3_joint': 1.06,
79 'lh_WRJ2': -0.03,
'lh_WRJ1': -0.02}
81 arm_joint_goals_3 = {
'la_shoulder_lift_joint': -1.86,
'la_elbow_joint': 1.90,
'la_wrist_2_joint': -0.18,
82 'la_wrist_1_joint': -0.96,
'la_shoulder_pan_joint': -1.78,
'la_wrist_3_joint': 1.06,
83 'lh_WRJ2': -0.03,
'lh_WRJ1': 0.15}
85 arm_joint_goals_4 = {
'la_shoulder_lift_joint': -1.33,
'la_elbow_joint': 1.11,
'la_wrist_2_joint': 1.00,
86 'la_wrist_1_joint': 0.13,
'la_shoulder_pan_joint': -1.49,
'la_wrist_3_joint': 3.27,
87 'lh_WRJ2': -0.03,
'lh_WRJ1': 0.15}
89 arm_joint_goals_5 = {
'la_shoulder_lift_joint': -1.45,
'la_elbow_joint': 1.11,
'la_wrist_2_joint': 0.90,
90 'la_wrist_1_joint': 0.45,
'la_shoulder_pan_joint': -0.95,
'la_wrist_3_joint': 0.09,
91 'lh_WRJ2': -0.03,
'lh_WRJ1': 0.16}
93 arm_joint_goals_6 = {
'la_shoulder_lift_joint': -1.35,
'la_elbow_joint': 1.16,
'la_wrist_2_joint': 0.96,
94 'la_wrist_1_joint': 0.39,
'la_shoulder_pan_joint': -0.91,
'la_wrist_3_joint': 0.09,
95 'lh_WRJ2': -0.03,
'lh_WRJ1': 0.15}
97 arm_joint_goals_7 = {
'la_shoulder_lift_joint': -1.35,
'la_elbow_joint': 1.04,
'la_wrist_2_joint': 1.55,
98 'la_wrist_1_joint': 0.08,
'la_shoulder_pan_joint': -1.64,
'la_wrist_3_joint': -1.41,
99 'lh_WRJ2': -0.03,
'lh_WRJ1': 0.15}
101 arm_joint_goals_8 = {
'la_shoulder_lift_joint': -1.55,
'la_elbow_joint': 1.41,
'la_wrist_2_joint': 0.02,
102 'la_wrist_1_joint': 0.61,
'la_shoulder_pan_joint': -1.55,
'la_wrist_3_joint': -0.57,
103 'lh_WRJ2': -0.04,
'lh_WRJ1': 0.16}
110 joint_goals = hand_joint_goals_1
111 rospy.loginfo(
"Moving hand to joint states\n" + str(joint_goals) +
"\n")
112 hand_commander.move_to_joint_value_target_unsafe(joint_goals, 3.0,
False)
113 joint_goals = arm_joint_goals_1
114 rospy.loginfo(
"Moving arm to joint states\n" + str(joint_goals) +
"\n")
115 arm_commander.move_to_joint_value_target_unsafe(joint_goals, 3.0,
True)
118 joint_goals = hand_joint_goals_2
119 rospy.loginfo(
"Moving hand to joint states\n" + str(joint_goals) +
"\n")
120 hand_commander.move_to_joint_value_target_unsafe(joint_goals, 3.0,
False)
121 joint_goals = arm_joint_goals_2
122 rospy.loginfo(
"Moving arm to joint states\n" + str(joint_goals) +
"\n")
123 arm_commander.move_to_joint_value_target_unsafe(joint_goals, 3.0,
True)
126 joint_goals = arm_joint_goals_3
127 rospy.loginfo(
"Moving arm to joint states\n" + str(joint_goals) +
"\n")
128 arm_commander.move_to_joint_value_target_unsafe(joint_goals, 1.0,
True)
131 joint_goals = hand_joint_goals_3
132 rospy.loginfo(
"Moving hand to joint states\n" + str(joint_goals) +
"\n")
133 hand_commander.move_to_joint_value_target_unsafe(joint_goals, 2.0,
True)
136 joint_goals = arm_joint_goals_6
137 rospy.loginfo(
"Moving hand to joint states\n" + str(joint_goals) +
"\n")
138 arm_commander.move_to_joint_value_target_unsafe(joint_goals, 3.0,
True)
141 joint_goals = hand_joint_goals_4
142 rospy.loginfo(
"Moving hand to joint states\n" + str(joint_goals) +
"\n")
143 hand_commander.move_to_joint_value_target_unsafe(joint_goals, 2.0,
True)
146 joint_goals = arm_joint_goals_5
147 rospy.loginfo(
"Moving hand to joint states\n" + str(joint_goals) +
"\n")
148 arm_commander.move_to_joint_value_target_unsafe(joint_goals, 2.0,
True)
151 joint_goals = arm_joint_goals_7
152 rospy.loginfo(
"Moving arm to joint states\n" + str(joint_goals) +
"\n")
153 arm_commander.move_to_joint_value_target_unsafe(joint_goals, 3.0,
False)
154 joint_goals = hand_joint_goals_5
155 rospy.loginfo(
"Moving hand to joint states\n" + str(joint_goals) +
"\n")
156 hand_commander.move_to_joint_value_target_unsafe(joint_goals, 3.0,
True)
159 named_target =
"la_home" 160 print(
"Moving arm to named target " + named_target)
161 arm_commander.move_to_named_target(named_target)
166 rospy.loginfo(
"Moving hand to joint state: open")
167 hand_commander.move_to_named_target(
"open")