-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy paththrow_demo.py
30 lines (22 loc) · 863 Bytes
/
throw_demo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from robot import Pepper
pepper = Pepper("10.37.1.227")
speed = 0.1
pepper.stand()
# Raise a hand to human
pepper.motion_service.angleInterpolationWithSpeed(["RShoulderPitch", "RWristYaw", "RHand"], [0.8, 2.5, 1.0], speed)
# Wait to touch a hand
while True:
try:
status = pepper.memory_service.getData("HandRightBackTouched")
if status:
pepper.motion_service.angleInterpolationWithSpeed("RHand", 0.0, speed)
break
except KeyboardInterrupt:
break
# Get hand down
pepper.motion_service.angleInterpolationWithSpeed(["RShoulderPitch", "RWristYaw", "RHand"], [3.5, 0.00, 0.0], speed)
# Throw a ball
pepper.motion_service.angleInterpolationWithSpeed(["RShoulderPitch", "RWristYaw"], [1.0, 2.5], speed)
pepper.motion_service.angleInterpolationWithSpeed("RHand", 1.0, speed)
# Reset position
pepper.stand()