바이오닉 핸드 - USB 및 BLE 제어
BrainCo Revo II 설정 가이드
USB 또는 BLE 연결부터 교정, 자세 제어 및 플랫폼 통합까지 BrainCo Revo II 생체 공학 손의 단계별 설정입니다.
1
USB-CDC 연결
Python 종속성 설치
pip install pyserial websockets
포트 연결 및 식별
Revo II를 USB로 연결하세요. Linux에서 장치는 다음과 같이 열거됩니다. /dev/ttyACM0 (또는 다른 ACM 장치가 있는 경우 ttyACM1). Windows에서는 장치 관리자에서 COM 포트를 확인하세요.
ls /dev/ttyACM* # Linux — find the device # Windows: check Device Manager → Ports (COM & LPT)
Linux에서 권한 수정
권한 거부 오류가 발생하면 사용자를 dialout 그룹화한 후 로그아웃했다가 다시 로그인하세요.
sudo usermod -aG dialout $USER
# Log out and back in for the change to take effect
전송 속도
Revo II는 정확하게 통신합니다. 115200보드. 다른 속도를 사용하면 읽을 수 없는 출력이 생성됩니다. 명령은 줄 바꿈으로 끝나는 UTF-8 JSON 문자열입니다.
2
저전력 블루투스(BLE) 연결
동일한 JSON 명령 프로토콜이 BLE GATT를 통해 작동합니다. 무선 배포에는 이 경로를 사용하십시오.
BLE 라이브러리 설치
pip install bleak
Revo II 스캔
import asyncio
from bleak import BleakScanner
async def scan():
devices = await BleakScanner.discover(timeout=5.0)
for d in devices:
print(d.address, d.name)
asyncio.run(scan())
# Look for a device named "BrainCo" or similar — note its address
BLE GATT UUID
- 서비스:
0000ffe0-0000-1000-8000-00805f9b34fb - 쓰기 특성:
0000ffe1-0000-1000-8000-00805f9b34fb - 알림 특성:
0000ffe2-0000-1000-8000-00805f9b34fb
BLE를 통해 연결하고 명령 보내기
import asyncio, json from bleak import BleakClient WRITE_CHAR = "0000ffe1-0000-1000-8000-00805f9b34fb" ADDRESS = "AA:BB:CC:DD:EE:FF" # replace with your device address async def main(): async with BleakClient(ADDRESS) as client: # Close all fingers to 50% cmd = json.dumps({"cmd": "set_pose", "positions": [50,50,50,50,50]}) await client.write_gatt_char(WRITE_CHAR, cmd.encode("utf-8"), response=False) await asyncio.sleep(1.0) # Open all fingers cmd2 = json.dumps({"cmd": "set_pose", "positions": [0,0,0,0,0]}) await client.write_gatt_char(WRITE_CHAR, cmd2.encode("utf-8"), response=False) asyncio.run(main())
3
첫 번째 포즈 명령(USB)
JSON 프로토콜의 위치 값은 정수 0~100(폐쇄율)입니다. Python SDK는 정규화된 부동 소수점 0.0~1.0을 사용하고 내부적으로 변환합니다.
원시 직렬 명령
import serial, json, time
port = serial.Serial("/dev/ttyACM0", baudrate=115200, timeout=1.0)
def set_pose(positions):
pcts = [int(p * 100) for p in positions]
cmd = json.dumps({"cmd": "set_pose", "positions": pcts}) + "\n"
port.write(cmd.encode("utf-8"))
# Open all fingers
set_pose([0.0, 0.0, 0.0, 0.0, 0.0])
time.sleep(1.0)
# Point with thumb extended, close others
set_pose([0.0, 0.8, 0.8, 0.8, 0.8])
time.sleep(1.0)
# Fist
set_pose([1.0, 1.0, 1.0, 1.0, 1.0])
time.sleep(1.0)
# Open again
set_pose([0.0] * 5)
port.close()
손가락 인덱스 매핑
- 0 — 엄지(2 DOF: 굴곡 + 회전 = 굴곡 × 0.4)
- 1 — 인덱스(1 DOF 굴곡)
- 2 — 중간(1 DOF 굴곡)
- 3 — 링(1 DOF 굴곡)
- 4 — 핑키(1 DOF 굴곡)
한 손가락 설정
# Set index finger to 75% closure
cmd = json.dumps({"cmd": "set_finger", "finger": 1, "position": 75}) + "\n"
port.write(cmd.encode("utf-8"))
하드웨어가 없나요? 모의 모드 사용
달리다
python brainco_revo_agent.py --mock --session test --self-test 물리적 장치 없이 모든 API 방법과 피아노 프레스 시퀀스를 연습할 수 있습니다.
4
교정 웨이브 시퀀스
보정은 펌웨어에서 손가락당 이동 제한을 설정합니다. 처음 연결한 후와 기계적 조정 후에 이를 실행하십시오.
교정 순서(자동)
- 모든 손가락이 0% 닫힘까지 열림
- 기계적 안정을 위해 300ms를 기다립니다.
- 각 손가락에 대해(엄지손가락 → 검지 → 가운데 → 약지 → 새끼손가락):
- 거의 90% 닫힘 - 120ms 기다림
- 0% 폐쇄로 열림 - 120ms 기다림
- 모든 손가락이 호버 위치에 고정됩니다(15% 닫힘).
- 보내다
{"cmd": "calibrate"}펌웨어 제한을 고정하려면
SDK를 통해 교정 실행
import asyncio
from brainco_revo_agent import BrainCoReVoController
async def calibrate():
ctrl = BrainCoReVoController(mock=False)
await ctrl.connect("/dev/ttyACM0")
await ctrl.calibrate() # runs full wave then sends calibrate cmd
print("Calibration complete")
await ctrl.disconnect()
asyncio.run(calibrate())
5
플랫폼 Teleop 통합
그만큼 brainco_revo_agent.py WebSocket을 통해 Revo II를 RoboticsCenter 플랫폼에 연결하여 브라우저에서 원격 작동, 손가락 위치 모니터링 및 데모 데이터 수집을 가능하게 합니다.
에이전트 실행
# Real hardware (USB) python brainco_revo_agent.py \ --backend wss://your-backend.run.app \ --session YOUR_SESSION_ID \ --device /dev/ttyACM0 # Real hardware (BLE) python brainco_revo_agent.py \ --backend wss://your-backend.run.app \ --session YOUR_SESSION_ID \ --ble AA:BB:CC:DD:EE:FF # Mock mode — no hardware required python brainco_revo_agent.py \ --backend ws://localhost:8000 \ --session test-session \ --mock
플랫폼을 통한 피아노 모드
브라우저 텔레오프 패널에서 피아노 키 누르기를 트리거합니다. 누를 때마다 확장(20ms) → 구동(30ms) → 유지 → 후퇴(20ms)의 4단계 순서가 실행됩니다. 동시 손가락 누르기가 지원됩니다.
고급 SDK API
import asyncio
from brainco_revo_agent import BrainCoReVoController
async def main():
ctrl = BrainCoReVoController(mock=False)
await ctrl.connect("/dev/ttyACM0")
# Set all fingers to 60% closure
await ctrl.set_hand_pose([0.6, 0.6, 0.6, 0.6, 0.6])
await asyncio.sleep(0.5)
# Read current state
snap = await ctrl.snapshot()
print(snap["positions_dict"]) # {"thumb":0.6, "index":0.6, ...}
await ctrl.disconnect()
asyncio.run(main())