def resetCamera(): print "Resetting Camera" bot.moveToDegAngle(5, 0, cameraSpeed) bot.moveToDegAngle(6, 0, cameraSpeed) bot.moveToDegAngle(7, 0, cameraSpeed)
def stop(): print "Stopping Servos" bot.spinAtPcSpeed(1, 0) bot.spinAtPcSpeed(2, 0) bot.spinAtPcSpeed(3, 0) bot.spinAtPcSpeed(4, 0)
else: print "No data available" buttonList = command[-12:] #Set buttonList to the button values in command #Iterate through buttonList, calling the appropriate function for any active button for button in range(len(buttonList)): if buttonList[button]: buttonScripts[button]() #Call the appropriate function from buttonScripts #Send throttle and steering data to be prepared to g to the wheels turn = throttleSteeringToLeftRight(command[0], command[1]) #Set servo speeds bot.spinAtPcSpeed(1, turn[0]) bot.spinAtPcSpeed(2, turn[1]) bot.spinAtPcSpeed(3, turn[1]) bot.spinAtPcSpeed(4, turn[0]) #Update camera positions cameraPos[0] += command[5] #Update target location for Servo 5 cameraPos[1] += command[3] #Update target location for Servo 6 cameraPos[2] += -command[2] #Update target location for Servo 7 #Move camera to positions bot.moveToDegAngle(5, cameraPos[0], cameraSpeed) bot.moveToDegAngle(6, cameraPos[1], cameraSpeed) bot.moveToDegAngle(7, cameraPos[2], cameraSpeed)