forked from pabloduque0/Hit-emWitADab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNaeNae.py
76 lines (52 loc) · 2.38 KB
/
NaeNae.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
from naoqi import ALProxy
import almath
def naeNae(motion_proxy):
motion_proxy.openHand("RHand")
names = ["RKneePitch", "LKneePitch","LHipPitch", "RHipPitch",
"RShoulderPitch", "RShoulderRoll", "RElbowYaw", "RElbowRoll",
"RWristYaw"]
angleLists = [25*almath.TO_RAD, 25*almath.TO_RAD, -32*almath.TO_RAD, -32*almath.TO_RAD,
-100*almath.TO_RAD, -76*almath.TO_RAD, 20*almath.TO_RAD, 60*almath.TO_RAD,
10*almath.TO_RAD]
timeLists = 1.0
isAbsolute = True
#motionProxy.stiffnessInterpolation(stiffnessNames, stiffnessList, timeLists)
motion_proxy.angleInterpolation(names, angleLists, timeLists, isAbsolute)
motion_proxy.waitUntilMoveIsFinished()
names2 = ["LHipRoll", "RHipRoll", "RElbowRoll"]
angleLists2 = [-10 * almath.TO_RAD, -10 * almath.TO_RAD, 88.5 * almath.TO_RAD]
timeLists = 0.6
motion_proxy.angleInterpolation(names2, angleLists2, timeLists, isAbsolute)
names3 = ["LHipRoll", "RHipRoll", "RElbowRoll"]
angleLists3 = [10 * almath.TO_RAD, 10 * almath.TO_RAD, 30 * almath.TO_RAD]
timeLists = 0.6
motion_proxy.angleInterpolation(names3, angleLists3, timeLists, isAbsolute)
def whip(motion_proxy):
motion_proxy.closeHand("RHand")
names = ["RElbowYaw", "RWristYaw"]
angleLists = [80 * almath.TO_RAD, 80 * almath.TO_RAD]
timeLists = 0.5
isAbsolute = True
motion_proxy.angleInterpolation(names, angleLists, timeLists, isAbsolute)
names = ["RShoulderPitch", "RShoulderRoll", "RElbowRoll", "RWristYaw" , "RElbowYaw"]
angleLists = [-10 * almath.TO_RAD, -0 * almath.TO_RAD, -50* almath.TO_RAD, -10* almath.TO_RAD, -15* almath.TO_RAD]
motion_proxy.angleInterpolation(names, angleLists, timeLists, isAbsolute)
motion_proxy.waitUntilMoveIsFinished()
naeNae(motion_proxy)
try:
tts = ALProxy("ALTextToSpeech", "169.254.123.55", 9559)
except Exception as e:
print("Could not create proxy to ALMotion")
print('{}{}'.format("Error was: ", e))
try:
motion_proxy = ALProxy("ALMotion", "169.254.123.55", 9559)
except Exception as e:
print("Could not create proxy to ALMotion")
print('{}{}'.format("Error was: ", e))
isEnabled = True
motion_proxy.wbEnable(isEnabled)
namesStiff = ["Body"]
stiffnessList = 1.0
stiffTime = 5.0
motion_proxy.stiffnessInterpolation(namesStiff, stiffnessList, stiffTime)
whip(motion_proxy)