def faceLook(d): if (d==0): #if no face is available if (c>=60): #print(c) data="A120sB30C30D20E0" luciserial.servorotate2(data) print("[INFO] error 10")
def servosent(x,y,w,h): centerx=(x+w)/2 centery=(y+h)/2 servosent.xx = int(centerx) servosent.yy = int(centery) output = "X{0:d}Y{1:d}Z".format(servosent.xx, servosent.yy) print(x, y, servosent.xx, servosent.yy , output) luciserial.servorotate2(output)
def shy(): #shy pass value to class #head x #neck y #hand =h #leg =l #foot =f #move hand and leg only servosent.ll = 40 # init of servvo3 servosent.hh = 0 # init of servo4 data = "X{0:d}Y{1:d}H{2:d}L{3:d}F{4:d}".format(servosent.xx, servosent.yy, servosent.hh, servosent.ll, servosent.ff) luciserial.servorotate2(data) print(data)
def servoini(): #initial positions x = 90 y = 50 h = 0 l = 0 f = 0 data = "X{0:d}Y{1:d}H{2:d}L{3:d}F{4:d}".format(x, y, h, l, f) luciserial.servorotate2(data) try: x = 90 y = 50 h = 0 l = 0 f = 0 data = "X{0:d}Y{1:d}H{2:d}L{3:d}F{4:d}".format(x, y, h, l, f) luciserial.servorotate2(data) except: print("Error! no serial module attached(Check setup.py for debug) ") sleep(.5) print("[INFO]reached initial position of servo") print("[INFO]reset complete!")