<jupyter_start><jupyter_text>Demo of moving Brunel hand via rerobots APIThis is free software, released under the Apache License, Version 2.0.You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0To learn more about our services, go to https://help.rerobots.net/Copyright (c) 2018 rerobots, Inc.<jupyter_code>API_TOKEN = ''  # GET YOUR TOKEN FROM https://rerobots.net/tokens
!pip install rerobots
!pip install paramiko
import time
import matplotlib.pyplot as plt
%matplotlib inline
from rerobots.api import Instance


instance = Instance(['fixed_brunelhand'], api_token=API_TOKEN)
## Wait for instance to finish initializing

while True:
    if instance.get_status() == 'READY':
        break
    time.sleep(2)
instance.get_details()
## Start the "cam" add-on, which supports video streaming

while True:
    payload = instance.status_addon_cam()
    if payload['status'] == 'active':
        break
    elif payload['status'] == 'notfound':
        instance.activate_addon_cam()
    time.sleep(2)
## Display the Brunel hand as it is now

payload = instance.get_snapshot_cam(format='ndarray')

if not payload['success']:
    time.sleep(1)
    payload = instance.get_snapshot_cam(format='ndarray')
    assert payload['success']

plt.imshow(payload['data'])
instance.start_sshclient()
instance.exec_ssh('pip install -U bhand pyserial')
print(str(instance.exec_ssh('bhand'), encoding='utf-8'))
## Enable motors, and make fist

instance.exec_ssh('bhand --raw A3')
instance.exec_ssh('bhand --raw G0')
time.sleep(1)  # time for action to finish...
## Display the result

payload = instance.get_snapshot_cam(format='ndarray')
plt.imshow(payload['data'])
# Done!

instance.terminate()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12226066897347174, 'fraction_numerical': 0.00865051903114187, 'mean_word_length': 4.921501706484642, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 3, 'lorem ipsum': 0, 'www.': 1, '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}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '218081', 'license': 'Apache-2.0', 'n_tokens_mistral': 567, 'n_tokens_neox': 550, 'n_words': 152, 'path': 'handmotion.ipynb', 'repo_name': 'rerobots/examples', 'size': '1734'}