Beispiel #1
0
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)
Beispiel #2
0
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)
Beispiel #3
0
 def handle(self, *args, **options):
     bot = Bot('localhost:8000', 'suap')
     for message in bot.messages:
         message.repply(message.text)
Beispiel #4
0
        return None
    coords = coords[0][1]
    if len(coords) < 1 or ',' not in coords:
        return None
    return (int(coords.split(',')[0][1:].replace(' ','')), int(coords.split(',')[1][:-1].replace(' ','')) )

def print_usage():
    print 'python calibrate.py UDID /dev/usb-port'

if len(argv) < 2 or not argv[2].startswith("/dev/"):
    print_usage()
    exit(-1)

# create a bot instance
print 'Making robot'
bot = Bot(argv[2])

# create an appium instance
print 'Launching Calibration App'
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")
Beispiel #5
0
    # setup appium
    app.ios_client = Appium(args.app, args.UDID, args.verbose)

    # setup robot (if necessary)
    app.robot_usb_address = args.robot_usb_address
    app.robot_calibration_file = args.robot_calibration_file
    app.uses_robot = app.robot_usb_address is not None
    if app.uses_robot:
        if args.UDID is None:
            raise Exception(
                'Robots cannot be used with the simulator, please supply a UDID'
            )

        # TODO fix package situation so proper imports can be done
        botpath = os.path.abspath(
            os.path.join(
                os.path.split(os.path.abspath(__file__))[0], 'robot',
                'bitbeambot-d2'))
        sys.path.append(botpath)
        from robot import Bot
        app.robot = Bot(app.robot_usb_address, app.robot_calibration_file)

    if args.address is None:
        try:
            args.address = socket.gethostbyname(socket.gethostname())
        except:
            args.address = '127.0.0.1'
    app.SESSION_ID = "%s:%d" % (args.address, args.port)
    app.started = False
    run(app, host=args.address, port=args.port)
Beispiel #6
0
        return None
    return (int(coords.split(',')[0][1:].replace(' ', '')),
            int(coords.split(',')[1][:-1].replace(' ', '')))


def print_usage():
    print 'python calibrate.py UDID /dev/usb-port'


if len(argv) < 2 or not argv[2].startswith("/dev/"):
    print_usage()
    exit(-1)

# create a bot instance
print 'Making robot'
bot = Bot(argv[2])

# create an appium instance
print 'Launching Calibration App'
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")