Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
Arm Planning Example
Description: Shows how to make the arm wave.Tutorial Level: BEGINNER
Contents
(This example was presented in a Google I/O talk by Ken Conley and Brian Gerkey.)
Start the Cartesian controller for the right arm (use the launch file in pr2_simulator/Tutorials/Teleop PR2 arm in simulation)
Create a file, for example, wave.py, and paste the following code into it:
1 import math, time
2
3 # create pose message: 0.5 meters in front of right shoulder
4 p = PoseStamped(frame_id='r_torso_lift_side_plate_link')
5 p.pose.orientation.y = -math.sqrt(2)/2.0
6 p.pose.orientation.w = math.sqrt(2)/2.0
7 p.pose.position.x = 0.5
8
9 # publish loop
10 r = Rate(10)
11 while ok():
12 p.pose.position.y = math.sin(1.5*time.time())*0.3
13 topics.r_cart.command_pose(p)
14 r.sleep()
Run this from the command line as follows:
rosrun rosh rosh wave.py