-
Notifications
You must be signed in to change notification settings - Fork 0
/
turn.py
31 lines (25 loc) · 921 Bytes
/
turn.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
import argparse
import motion
import time
from naoqi import ALProxy
def main(robotIP, PORT = 9559, turn = "left"):
motionProxy = ALProxy("ALMotion", robotIP, PORT)
postureProxy = ALProxy("ALRobotPosture", robotIP, PORT)
motionProxy.wakeUp()
postureProxy.goToPosture("StandInit", 0.5)
motionProxy.setMoveArmsEnabled(True, True)
motionProxy.setExternalCollisionProtectionEnabled("All", False)
if turn == "left":
theta = .5
else:
theta = -.5
# X, Y, Theta, Freq
motionProxy.setWalkTargetVelocity(0, 0, theta, 1)
time.sleep(3.65)
motionProxy.setWalkTargetVelocity(0, 0, 0, 0) # stop motion
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--dir", type = str, default = "left",
help = "direction to turn")
args = parser.parse_args()
main("nico.d.mtholyoke.edu", 9559, args.dir)