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
|
from naoqi import ALProxy import threading IP="192.168.1.109" port=9559
motionPrx=ALProxy("ALMotion",IP,port) touchProxy=ALProxy("ALTouch",IP,port) memory=ALProxy("ALMemory",IP,port)
config=[ ["MaxStepX",0.04], ["MaxStpY",0.02], ["StepHeight",0.02], ["MaxStepFrequency",0.3] ]
def move(): while True: motionPrx.moveTo(0.5,0.0,0.0,config) if Front==1: break
def touch(): while True: global Front Front=memory.getData("FrontTactilTouched") if Front==1: motionPrx.rest() break
if __name__=='__main__': motionPrx.wakeUp() t1=threading.Thread(target=touch) t2=threading.Thread(target=move) t1.start() t2.start() t1.join() t2.join()
|