# outputs its results memValue = "/BURST/Vision/BallX" # Create a proxy to ALMemory try: memoryProxy = ALProxy("ALMemory", IP, PORT) except Exception, e: print "Error when creating memory proxy:" print str(e) exit(1) visionProxy.setCamera(1) # 0 - top camera, 1 - bottom camera TimeInterpolation = 0.05 motionProxy.setJointStiffness('HeadYaw',1.0) #,TimeInterpolation motionProxy.gotoAngle("HeadYaw",0.23,TimeInterpolation*10,1) #0.23 #0.31 visionProxy.getBall() time.sleep(1.0) #motionProxy.gotoAngle("HeadYaw",-0.15,TimeInterpolation*10,1) #0.23 #print (10*motion.TO_RAD) #exit(0) while True: #for i in range(0, 1): #time.sleep(0.1) #print(i) #visionProxy.getBallRemote() visionProxy.getBall() visionProxy.getBall()
# to get notified when the memValue changes TimeInterpolation = 0.05 motionProxy.setJointStiffness('HeadYaw',1.0,TimeInterpolation) newHeadYaw = 0.2 for i in range(0, 5): time.sleep(0.5) print(i) # head between -2 (right) to 2 (left) # ball between 0 (left) to 640 (right) newHeadYaw = 0.2 motionProxy.gotoAngle("HeadYaw",newHeadYaw,TimeInterpolation*10,1) # if(val): # if(val[0]>0): # # we detected logos ! # # for each logo, we can read its coordinates # print "Number of logos detected:", val[0] # for i in range(0, val[0]): # print " ID: %d , x: %f, y: %f, sx: %f" % (val[i+1][0], val[i+1][1], val[i+1][2], val[i+1][3]) # else: # print "* No logo detected" motionProxy.setJointStiffness('HeadYaw',0.0,TimeInterpolation) print "Test terminated successfully"