<commit_before>import time
from Orion5 import Orion5
from General import ComQuery

# search for an Orion5
comport = None
print('\nSearching for Orion5...')
while True:
    comport = ComQuery()
    if comport is not None:
        print('Found Orion5, serial port name:', comport.device)
        break
    time.sleep(2)

orion = Orion5(comport.device)
time.sleep(3)

def gotoPositionBlocking(pos):
    orion.claw.setVariable('control variables', 'goalPosition', pos)
    while abs(pos - orion.claw.getVariable('feedback variables', 'currentPosition')) > 2:
        print('%.2f' % orion.claw.getVariable('feedback variables', 'currentPosition'))
        time.sleep(0.2)

try:

    gotoPositionBlocking(359.0)

    orion.claw.setVariable('misc variables', 'cwAngleLimit', 1060)
    orion.claw.setVariable('misc variables', 'ccwAngleLimit', 1059)

    gotoPositionBlocking(170.0)

    orion.claw.setVariable('misc variables', 'cwAngleLimit', 0)
    orion.claw.setVariable('misc variables', 'ccwAngleLimit', 1087)

    gotoPositionBlocking(359.0)

    input('\nPress enter if claws are ejected\nCtrl+C and relaunch if claws are not ejected yet')

    orion.claw.setVariable('misc variables', 'cwAngleLimit', 1060)
    orion.claw.setVariable('misc variables', 'ccwAngleLimit', 1059)

    gotoPositionBlocking(135.0)

    input('\nPosition claws now - press enter when ready')

    gotoPositionBlocking(355.0)

    orion.claw.setVariable('misc variables', 'cwAngleLimit', 0)
    orion.claw.setVariable('misc variables', 'ccwAngleLimit', 1087)

    gotoPositionBlocking(120.0)

except KeyboardInterrupt:
    print('Exiting...')
except Exception as e:
    print(e)
finally:
    orion.exit()
    print('Finished')<commit_msg>more info about claw positioning<commit_after>import time
from Orion5 import Orion5
from General import ComQuery

# search for an Orion5
comport = None
print('\nSearching for Orion5...')
while True:
    comport = ComQuery()
    if comport is not None:
        print('Found Orion5, serial port name:', comport.device)
        break
    time.sleep(2)

orion = Orion5(comport.device)
time.sleep(3)

def gotoPositionBlocking(pos):
    orion.claw.setVariable('control variables', 'goalPosition', pos)
    while abs(pos - orion.claw.getVariable('feedback variables', 'currentPosition')) > 2:
        print('%.2f' % orion.claw.getVariable('feedback variables', 'currentPosition'))
        time.sleep(0.2)

try:

    gotoPositionBlocking(359.0)

    orion.claw.setVariable('misc variables', 'cwAngleLimit', 1060)
    orion.claw.setVariable('misc variables', 'ccwAngleLimit', 1059)

    gotoPositionBlocking(170.0)

    orion.claw.setVariable('misc variables', 'cwAngleLimit', 0)
    orion.claw.setVariable('misc variables', 'ccwAngleLimit', 1087)

    gotoPositionBlocking(359.0)

    input('\nPress enter if claws are ejected\nCtrl+C and relaunch if claws are not ejected yet')

    orion.claw.setVariable('misc variables', 'cwAngleLimit', 1060)
    orion.claw.setVariable('misc variables', 'ccwAngleLimit', 1059)

    gotoPositionBlocking(135.0)

    input('\nPosition claws around pinion gear\n80mm between inner faces\n40mm from centre of gear to claw face\npress enter when ready')

    gotoPositionBlocking(355.0)

    orion.claw.setVariable('misc variables', 'cwAngleLimit', 0)
    orion.claw.setVariable('misc variables', 'ccwAngleLimit', 1087)

    gotoPositionBlocking(120.0)

except KeyboardInterrupt:
    print('Exiting...')
except Exception as e:
    print(e)
finally:
    orion.exit()
    print('Finished')
{'fraction_non_alphanumeric': 0.12195121951219512, 'fraction_numerical': 0.036301758366420876, 'mean_word_length': 4.19440353460972, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '641677', 'n_tokens_mistral': 1258, 'n_tokens_neox': 1134, 'n_words': 268}