def Run(command): #api.Walk(True) #print("Running...") #move foward if(command == 1): api.PlayAction(15) print('Sit') command = 0 #api.WalkMove(0) #api.Walk(True) #api.WalkMove(20) #move back elif(command == 10): print (api.passAccelData2(1)) elif(command == 0): api.PlayAction(8) print('Stand up') command = 1 #print("supposed to move backwards") #move right elif(command == 8): api.WalkMove(0) api.WalkTurn(20) #move left elif(command == 9): api.WalkMove(0) api.WalkTurn(-20) elif(command == 5): api.WalkMove(0)
if(rms>THRESHOLD and snapflag == 1): snapflag = 2 Pose ='FIST' firstclaptime = float(time.clock()) print "timers",firstclaptime , time.clock() print "<<<=======Single Tap=====>>>" elif(rms>THRESHOLD and snapflag == 2 and ((time.clock() - firstclaptime ) < timethresh)): snapflag = 1 Pose ='FINGER_SPREAD' print "<<<======Finger Spread ====>>>" elif(rms>THRESHOLD and snapflag == 2 and ((time.clock() - firstclaptime ) > timethresh)): snapflag = 1 Pose = 'Blank' print"<<======No Pose=====>>>>>" data = '\x00' * CHUNK Accel = (api.passAccelData2(1)) count = pixy_get_blocks(100, blocks) print "Accelrometer = ", Accel if count > 0: # Blocks found # frame += 1 sawSig1, sawSig2 = False, False y1, y3 = 0, 0 for index in range (0, count): print('[BLOCK_TYPE=%d SIG=%d X=%3d Y=%3d WIDTH=%3d HEIGHT=%3d]' % \ (blocks[index].type, blocks[index].signature, blocks[index].x, blocks[index].y,blocks[index].width, blocks[index].height)) if blocks[index].signature == 4: sawSig2 = True X = blocks[index].x elif blocks[index].signature == 5: