Metadata-Version: 2.1
Name: amarettopy
Version: 0.0.5
Summary: python API for Buildit Actuator
Home-page: https://github.com/Smartrobotics/AmarettoPy
Author: SR
Author-email: sr-dev@smartrobotics.jp
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
Requires-Dist: crc8
Requires-Dist: numpy
Requires-Dist: pyserial
Requires-Dist: matplotlib
Requires-Dist: numpy
Requires-Dist: pyyaml

# AmarettoPy

Python library to control Buildit servo actuators (only for python3)


## Install

### Windows

```
$ pip3 install amarettopy
```

### Ubuntu

```
$ sudo apt-get -y install python3-tk
$ pip3 install amarettopy
```

## Usage

### amarettopy library

* ライブラリについてのドキュメント
    * https://smartrobotics.github.io/AmarettoPy-doc/amarettopy.html

* 初期化

```
>>> from amarettopy import *
>>> amaretto = AmarettoPy(port="/dev/ttyXXXX", timeout_ms=3000) #for Linux
>>> amaretto = AmarettoPy(port="COMX", timeout_ms=3000) #for Win
>>> deviceId = 1
```

* 現在の位置や速度といった情報の取得

```
>>> (position, velocity, current, referenceValue, temperature, faults) = amaretto.query_servo_status(deviceId)
>>> print(state2str(amaretto.state()))
```

* 速度制御と位置制御の方法

```
>>> #amaretto.clear_fault(deviceId)
>>> amaretto.ready(deviceId)
>>> amaretto.set_ref_velocity(deviceId, fromRPM(42.5))
>>> amaretto.set_ref_position(deviceId, fromDegree(180))
```


### amrtctl

amrtctl は AmarettoPy の各メソッドをコマンドラインから呼び出す為のツールです。
アクチュエーターの状態を確認する場合は以下のように実行します。

```
$ amrtctl query-servo-status -d 1 -p /dev/ttyUSB0
state: STATE_HOLD
pos: -51636
vel: 0
cur: 0
ref: 0
temp: 26
faults: NO_FAULTS
```

速度制御を行う場合は以下のように実行します。

```
$ amrtctl ready -d 1 -p /dev/ttyUSB0

$ amrtctl set-ref-velocity 2500 -d 1 -p /dev/ttyUSB0 # 指定速度の単位は [rpm/100]
0
```

位置制御を行う場合は以下のように実行します。

```
$ amrtctl stop -d 1 -p /dev/ttyUSB0

$ amrtctl set-ref-position 2500 -d 1 -p /dev/ttyUSB0 # 指定位置の単位は [360/65536 度]
-39775
```


### amrtct-gui

amrtctl は AmarettoPy の各メソッドをコマンドラインから呼び出す為のツールです。

```
$ amrtctl-gui
```

ポートを選択し、Connectボタンを押した後、各種ボタンを使ってデバイスを操作することが出来ます。







