currentHeadYaw = motionProxy.getAngle("HeadYaw") print "currentHeadYaw: %f" % currentHeadYaw xtodeg = ((160.0-val)/160.0) # between 1 (left) to -1 (right) print "xtodeg: %f" % xtodeg if (abs(xtodeg)>0.05): xtodegfactor = 23.2 #46.4/2 newHeadYaw = currentHeadYaw + (xtodeg*xtodegfactor*motion.TO_RAD) print "newHeadYaw: %f" % newHeadYaw #motionProxy.setAngle("HeadYaw",(320.0-val)/320.0/2) motionProxy.gotoAngle("HeadYaw",newHeadYaw,TimeInterpolation*10,1) #print "test: %f" % ((320.0-val)/320.0/2) else: print "* No ball detected" # 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) visionProxy.unRegisterFromVIM() print "Test terminated successfully"
try: sampleProxy = ALProxy("vision", IP, PORT) except Exception, e: print "Error when creating vision proxy:" print str(e) exit(1) time.sleep(1) print "Registering to VIM" sampleProxy.registerToVIM() print "done" #### # Save image in remote mode print "1" sampleProxy.saveImageRemote("/var/tmp/img") # /var/volatile/log/myBeautifullPictureRemote print "2" time.sleep(1) a = sampleProxy.getBallAreaRemote() print "3" # sampleProxy.saveImage("/var/tmp/myBeautifullPictureLocal") #/var/volatile/log/myBeautifullPictureLocal time.sleep(2) print "4" sampleProxy.unRegisterFromVIM() print "5" print "end of gvm_useGVMsample python script"