36 from trajectory_msgs.msg
import JointTrajectory, JointTrajectoryPoint
37 from sr_robot_commander.sr_robot_commander
import SrRobotCommander
38 from sr_robot_commander.sr_hand_commander
import SrHandCommander
39 from sr_robot_commander.sr_arm_commander
import SrArmCommander
41 rospy.init_node(
"left_hand_arm_ef_pos", anonymous=
True)
46 hand_commander = SrHandCommander(name=
"left_hand")
47 arm_commander = SrArmCommander(name=
"left_arm")
49 robot_commander = SrRobotCommander(name=
"left_arm_and_hand")
50 arm_commander.set_max_velocity_scaling_factor(0.1)
53 arm_home_joints_goal = {
'la_shoulder_pan_joint': 1.47,
'la_elbow_joint': -1.695,
54 'la_shoulder_lift_joint': -1.22,
'la_wrist_1_joint': -01.75,
55 'la_wrist_2_joint': 1.57,
'la_wrist_3_joint': -1.830}
57 example_pose_1 = [0.6, 0.3, 1.5, -0.7, 0.04, -0.67]
59 example_pose_2 = [0.6, 0.3, 1.46, -0.7, 0.04, 0.69, 0.08]
61 example_pose_3 = [0.69, 0.64, 1.4, -0.71, 0.04, 0.69, 0.08]
64 rospy.loginfo(
"Moving arm to joint states\n" + str(arm_home_joints_goal) +
"\n")
65 robot_commander.move_to_joint_value_target_unsafe(arm_home_joints_goal, 6.0,
True)
69 rospy.loginfo(
"Moving hand to joint state: open")
70 hand_commander.move_to_named_target(
"open")
75 rospy.loginfo(
"Moving hand to joint state: pack")
76 hand_commander.move_to_named_target(
"pack")
79 raw_input(
"Press Enter to continue...")
80 rospy.loginfo(
"Planning the move to the first pose:\n" + str(example_pose_1) +
"\n")
81 arm_commander.plan_to_pose_target(example_pose_1)
82 rospy.loginfo(
"Finished planning, moving the arm now.")
84 arm_commander.execute()
87 raw_input(
"Press Enter to continue...")
88 rospy.loginfo(
"Planning the move to the second pose:\n" + str(example_pose_2) +
"\n")
89 arm_commander.plan_to_pose_target(example_pose_2)
90 rospy.loginfo(
"Finished planning, moving the arm now.")
91 arm_commander.execute()
94 raw_input(
"Press Enter to continue...")
95 rospy.loginfo(
"Moving arm to pose:\n" + str(example_pose_1) +
"\n")
96 arm_commander.move_to_pose_target(example_pose_1, wait=
True)
100 raw_input(
"Press Enter to continue...")
101 rospy.loginfo(
"Moving arm to pose:\n" + str(example_pose_3) +
"\n")
102 arm_commander.move_to_pose_target(example_pose_3, wait=
True)
106 raw_input(
"Press Enter to continue...")
107 rospy.loginfo(
"Moving arm to joint states\n" + str(arm_home_joints_goal) +
"\n")
108 robot_commander.move_to_joint_value_target_unsafe(arm_home_joints_goal, 6.0,
True)
112 rospy.loginfo(
"Moving hand to joint state: open")
113 hand_commander.move_to_named_target(
"open")