---
# System prepended metadata

title: Rabboni
tags: [RVB, rabboni]

---

Rabboni
===
###### tags: `RVB` `rabboni`
# 介紹
imu
# 使用方式
Rabboni Python SDK 1.1.0 (Google Drive)
https://drive.google.com/drive/folders/1UyxtonAzTh3_pq-sgSsgtcsDW-9jV0lE?usp=sharing

manual:
http://140.113.169.170/rabboni_file/rabboni_manual_device_v1.1.pdf

相關網址：https://drive.google.com/drive/folders/1ElCVAZngcWG5aF0fVIxYDxp0OeYrzqnm?fbclid=IwAR3UK5S2eWz2Gcj3j-srg7Y_ShB3FH-f7QCILO7j7_xBm82rMFuBpB7s0zo

Rabboni Python SDK
========

Prerequisite
-----

### Linux
(建議: Ubuntu 20.04LTS)

* 下載並解壓縮 sdk
``` bash
$ cd
$ mkdir rab_sdk
$ cd rab_sdk
$ wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=1-UHxy0vb4wP9VQHKZzQ-Rp0S84KxHQtB' -O rabboni-python-sdk-1.1.0.tar.gz
$ tar zxvf rabboni-python-sdk-1.1.0.tar.gz
$ cd rabboni-python-sdk-1.1.0
```
* 安裝 libhidapi-hidraw0 (USB 模式)  
``` bash
$ sudo apt install libhidapi-hidraw0
$ sh generate-udev-rules.sh
```

* 安裝 python3 及相關  
``` bash
$ sudo apt install python3 python3-pip python3-tk
$ sudo python3 setup.py install
```
Example
-----

* USB 模式

``` python
import traceback as tb

from rabboni import Rabboni

rab = Rabboni()
rab.connect()

rab.set_sensor_config(8, 500, 20, 100)


def usb_custom_callback(status):
    """
    參數 status 為一個 dictionary
    eg.
    Acc: (X,Y,Z), Gyr: (X,Y,Z), Count: (CurrentCount, StoredCount)
    {'Acc': (0.614013671875, -0.583984375, 0.58349609375), 'Gyr': (-92.437744140625, -99.212646484375, 0.0152587890625), 'Count': (98, 0)}
    """
    print(status)

try:
    rab.start_fetching_status(custom_callback=usb_custom_callback)
    rab.polling_status()
except AssertionError:  # 結束程式
    print('Bye~!!')
except Exception:
    tb.print_exc()
finally:
    rab.export_csv()
    rab.export_plot()
    rab.disconnect()
```

```
$ sudo python3 usb_rabboni.py
```

# example
``` python
from rabboni impot *

rabbo = Rabboni(mode = "USB")
rabbo.connect()

print("Status:",rabbo.Status)
rabbo.set_sensor_scale(acc_scale = 4, gyr_scale = 2000) ## 設定加速度跟陀螺儀的最大範圍 建
議先設定完離線在進行檔案錄製
try:
 rabbo.read_data()
 while True:#一直打印資料 直到結束程式
 rabbo.print_data()#print 資料
 print (rabbo.data_num)
 if rabbo.Cur_Cnt > 10:
 rabbo.rst_count() #重置 count 會 delay 一下
 if rabbo.data_num>100:
 rabbo.stop()#停止運作
 break
except KeyboardInterrupt:#結束程式
 print('Shut done!')
 # print (rabbo.Accx_list)#印出到結束程式時的所有 Accx 值
 rabbo.stop()#停止運作
```