00001
00002
00003 import roslib
00004 roslib.load_manifest('pr2_simple_interface')
00005 roslib.load_manifest('sound_play')
00006
00007
00008
00009 from pr2_simple_interface import *
00010 from sound_play.msg import SoundRequest
00011 from sound_play.libsoundplay import SoundClient
00012 start()
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 gripper = Gripper()
00041 arm = RobotArm()
00042 head = Head()
00043 torso = Torso()
00044 sound = SoundClient()
00045
00046 rospy.sleep(1)
00047
00048
00049 torso.set(0.1)
00050
00051
00052 sound.say("Hi! I'm PR2.")
00053
00054
00055 head.look_at(1.0, 0.0, 0.5)
00056 head.wait_for()
00057 head.look_at(1.0, 0.0, 1.5)
00058 head.wait_for()
00059 head.look_at(1.0, 0.0, 0.5)
00060 head.wait_for()
00061 head.look_at(1.0, 0.0, 1.5)
00062 head.wait_for()
00063 head.look_at(1.0, 0.0, 1.0)
00064 head.wait_for()
00065 torso.set(0.0)
00066
00067
00068 head.look_at(1.0, 0.0, 1.0)
00069 head.wait_for()
00070
00071
00072 arm.move_to([-80, 40, 30, -110, 200, -30, -900], RIGHT)
00073 arm.move_to([80, 40, -30, -110, -200, 30, 900], LEFT)
00074 arm.wait_for(BOTH)
00075
00076 gripper.rel(BOTH)
00077 gripper.wait_for(BOTH)
00078
00079 rospy.sleep(2)
00080
00081 arm.move_to([-20, -15, -20, -50, 60, -5, 700], RIGHT)
00082 arm.move_to([20, -15, 20, -50, -60, 5, -700], LEFT)
00083
00084 sound.say("Double high fives.")
00085
00086 gripper.wait_for_slap(BOTH)
00087
00088 head.look_at(1.0, 0.0, 1.5)
00089 head.wait_for()
00090 head.look_at(1.0, 0.0, 1.0)
00091 head.wait_for()
00092
00093 sound.say("Slap one hand.")
00094
00095 if (gripper.determine_slap() == LEFT):
00096 head.look_at(1.0, 1.0, 0.5)
00097 head.wait_for()
00098 else:
00099 head.look_at(1.0, -1.0, 0.0)
00100 head.wait_for()
00101
00102 arm.move_to([70, 50, 40, -120, 100, -20, 20], LEFT)
00103 arm.move_to([-70, 50, -40, -120, -100, -20, -20], RIGHT)
00104 arm.wait_for(BOTH)
00105
00106 gripper.close(BOTH)
00107 gripper.wait_for(BOTH)
00108
00109
00110
00111
00112
00113 head.look_at(1.0, 0.0, 1.0)
00114 head.wait_for()
00115 sound.say("I'm looking for a face.")
00116 rospy.sleep(2)
00117 head.look_at_face()
00118 head.wait_for()
00119
00120
00121 sound.say("Goodbye.")