20 from trajectory_msgs.msg
import JointTrajectory, JointTrajectoryPoint
21 from sr_robot_commander.sr_arm_commander
import SrArmCommander
22 import geometry_msgs.msg
25 rospy.init_node(
"move_arm_following_waypoint_trajectory", anonymous=
True)
27 arm_commander = SrArmCommander(set_ground=
True)
29 rospy.sleep(rospy.Duration(1))
32 pose_1 = [0.32, 0.27, 1.026, 0.0, 0.0, 0.0, 1.0]
34 print "Moving to initial pose" 35 arm_commander.plan_to_pose_target(pose_1)
36 arm_commander.execute()
38 rospy.sleep(rospy.Duration(2))
40 print "Following trajectory defined by waypoints" 44 initial_pose = arm_commander.get_current_pose()
47 wpose = geometry_msgs.msg.Pose()
48 wpose.position.x = initial_pose.position.x
49 wpose.position.y = initial_pose.position.y - 0.20
50 wpose.position.z = initial_pose.position.z
51 wpose.orientation = initial_pose.orientation
52 waypoints.append(wpose)
54 wpose = geometry_msgs.msg.Pose()
55 wpose.position.x = initial_pose.position.x
56 wpose.position.y = initial_pose.position.y - 0.20
57 wpose.position.z = initial_pose.position.z - 0.20
58 wpose.orientation = initial_pose.orientation
59 waypoints.append(wpose)
61 wpose = geometry_msgs.msg.Pose()
62 wpose.position.x = initial_pose.position.x
63 wpose.position.y = initial_pose.position.y
64 wpose.position.z = initial_pose.position.z - 0.20
65 wpose.orientation = initial_pose.orientation
66 waypoints.append(wpose)
68 waypoints.append(initial_pose)
70 arm_commander.plan_to_waypoints_target(waypoints, eef_step=0.02)
71 arm_commander.execute()