from robot import Bot from time import sleep robot = Bot('/dev/tty.usbmodem5d11') rest_angles = (30, 30, 30) rest_position = robot.forward_k(30, 30, 30) center_angles = (40, 40, 40) center_position = robot.forward_k(40, 40, 40) top_angles1 = robot.inverse_k(0, rest_position[2] + 100, rest_position[3]) top_angles2 = robot.inverse_k(0, center_position[2] + 100, center_position[3]) bottom_angles1 = robot.inverse_k(0, rest_position[2] - 100, rest_position[3]) bottom_angles2 = robot.inverse_k(0, center_position[2] - 100, center_position[3]) right_angles1 = robot.inverse_k(rest_position[2] + 100, 0, rest_position[3]) right_angles2 = robot.inverse_k(center_position[2] + 100, 0, center_position[3]) left_angles1 = robot.inverse_k(rest_position[2] - 100, 0, rest_position[3]) left_angles2 = robot.inverse_k(center_position[2] - 100, 0, center_position[3]) robot.set_position(rest_angles) sleep(.5) print 'Center' robot.set_position(center_angles) sleep(.5) robot.set_position(rest_angles) sleep(2) print 'Top' robot.set_position(top_angles1)
driver = appium.Appium('Appium.RobotCalibration', argv[1]) driver.start() # lower the pen until the ios device is touched current_point = starting_position screen_center = None print 'Entering Calibration Loop' while current_point <= 80 and screen_center == None: current_point += 1 # exit if we did not touch the ios device if current_point > 80: raise Exception("Could not contact the iOS device") bot.move(current_point, current_point, current_point) screen_center = get_coords() contact_point = bot.forward_k(current_point, current_point, current_point) if contact_point[0] is not 0: raise Exception('Could not detect contact point') contact_point = (contact_point[1], contact_point[2], contact_point[3]) origin_point = bot.forward_k(starting_position, starting_position, starting_position) if origin_point[0] is not 0: raise Exception('Could not detect origin point') origin_point = (origin_point[1], origin_point[2], origin_point[3]) # add a mapping to the screen center mappings.append((screen_center, (bot.a.angle, bot.b.angle, bot.c.angle))) # return the device to the original position bot.move(starting_position,starting_position,starting_position)
from robot import Bot from time import sleep robot = Bot('/dev/tty.usbmodem5d11') rest_angles = (30,30,30) rest_position = robot.forward_k(30,30,30) center_angles = (40,40,40) center_position = robot.forward_k(40,40,40) top_angles1 = robot.inverse_k(0, rest_position[2]+100, rest_position[3]) top_angles2 = robot.inverse_k(0, center_position[2]+100, center_position[3]) bottom_angles1 = robot.inverse_k(0, rest_position[2]-100, rest_position[3]) bottom_angles2 = robot.inverse_k(0, center_position[2]-100, center_position[3]) right_angles1 = robot.inverse_k(rest_position[2]+100, 0, rest_position[3]) right_angles2 = robot.inverse_k(center_position[2]+100, 0, center_position[3]) left_angles1 = robot.inverse_k(rest_position[2]-100, 0, rest_position[3]) left_angles2 = robot.inverse_k(center_position[2]-100, 0, center_position[3]) robot.set_position(rest_angles) sleep(.5) print 'Center' robot.set_position(center_angles) sleep(.5) robot.set_position(rest_angles) sleep(2) print 'Top' robot.set_position(top_angles1) sleep(.5) robot.set_position(top_angles2)
driver = appium.Appium('Appium.RobotCalibration', argv[1]) driver.start() # lower the pen until the ios device is touched current_point = starting_position screen_center = None print 'Entering Calibration Loop' while current_point <= 80 and screen_center == None: current_point += 1 # exit if we did not touch the ios device if current_point > 80: raise Exception("Could not contact the iOS device") bot.move(current_point, current_point, current_point) screen_center = get_coords() contact_point = bot.forward_k(current_point, current_point, current_point) if contact_point[0] is not 0: raise Exception('Could not detect contact point') contact_point = (contact_point[1], contact_point[2], contact_point[3]) origin_point = bot.forward_k(starting_position, starting_position, starting_position) if origin_point[0] is not 0: raise Exception('Could not detect origin point') origin_point = (origin_point[1], origin_point[2], origin_point[3]) # add a mapping to the screen center mappings.append((screen_center, (bot.a.angle, bot.b.angle, bot.c.angle))) # return the device to the original position bot.move(starting_position, starting_position, starting_position)