-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpoint.py
64 lines (46 loc) · 1.5 KB
/
point.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
# -*- encoding: UTF-8 -*-
import sys
from naoqi import ALProxy
import time
import almath
def main(robotIP):
PORT = 9559
try:
motionProxy = ALProxy("ALMotion", robotIP, PORT)
except Exception,e:
print "Could not create proxy to ALMotion"
print "Error was: ",e
sys.exit(1)
motionProxy.setStiffnesses("Head", 1.0)
names = "HeadPitch"
angles = 10.0*almath.TO_RAD
fractionMaxSpeed = 0.05
motionProxy.setAngles(names,angles,fractionMaxSpeed)
time.sleep(1.5)
# Simple command for the HeadYaw joint at 10% max speed
names = "HeadYaw"
angles = 30.0*almath.TO_RAD
fractionMaxSpeed = 0.08
motionProxy.setAngles(names,angles,fractionMaxSpeed)
time.sleep(1.5)
angles = -30.0*almath.TO_RAD
fractionMaxSpeed = 0.08
motionProxy.setAngles(names,angles,fractionMaxSpeed)
time.sleep(3.0)
angles = 0
fractionMaxSpeed = 0.08
motionProxy.setAngles(names,angles,fractionMaxSpeed)
time.sleep(1.5)
names = "HeadPitch"
angles = 0
fractionMaxSpeed = 0.05
motionProxy.setAngles(names,angles,fractionMaxSpeed)
time.sleep(1.5)
motionProxy.setStiffnesses("Head", 0.0)
if __name__ == "__main__":
robotIp = "Meeseeks.local"
if len(sys.argv) <= 1:
print "Usage python almotion_controllingjoints.py robotIP (optional default: 127.0.0.1)"
else:
robotIp = sys.argv[1]
main(robotIp)