python API for Buildit Actuator
Project description
Buildit
Buildit Actuator を制御する為のPython3用ライブラリ
Install
Windows
$ pip3 install pybuildit
Ubuntu
$ sudo apt-get -y install python3-tk
$ pip3 install pybuildit
Usage
pybuildit library
-
ライブラリについてのドキュメント
-
初期化
- ※ 以下のデバイスファイル名やCOMポート番号は環境に合わせて変更する必要があります
>>> from pybuildit import *
>>> buildit = Buildit(port="/dev/ttyXXXX", timeout_ms=3000) #for Linux
>>> buildit = Buildit(port="COMX", timeout_ms=3000) #for Win
>>> deviceId = 1
- 現在の位置や速度といった情報の取得
>>> (position, velocity, current, referenceValue, temperature, faults) = buildit.query_servo_status(deviceId)
>>> print(state2str(buildit.state()))
- 速度制御と位置制御の方法
>>> #buildit.clear_fault(deviceId)
>>> buildit.ready(deviceId)
>>> buildit.set_ref_velocity(deviceId, fromRPM(42.5))
>>> buildit.set_ref_position(deviceId, fromDegree(180))
builditctl
builditctl は Buildit の各メソッドをコマンドラインから呼び出す為のツールです。 アクチュエーターの状態を確認する場合は以下のように実行します。
$ builditctl query-servo-status -d 1 -p /dev/ttyUSB0
state: STATE_HOLD
pos: -51636
vel: 0
cur: 0
ref: 0
temp: 26
faults: NO_FAULTS
速度制御を行う場合は以下のように実行します。
$ builditctl ready -d 1 -p /dev/ttyUSB0
$ builditctl set-ref-velocity 2500 -d 1 -p /dev/ttyUSB0 # 指定速度の単位は [rpm/100]
0
位置制御を行う場合は以下のように実行します。
$ builditctl stop -d 1 -p /dev/ttyUSB0
$ builditctl set-ref-position 2500 -d 1 -p /dev/ttyUSB0 # 指定位置の単位は [360/65536 度]
-39775
builditct-gui
builditctl は Buildit の各メソッドをコマンドラインから呼び出す為のツールです。
$ builditctl-gui
ポートを選択し、Connectボタンを押した後、各種ボタンを使ってデバイスを操作することが出来ます。
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pybuildit-0.0.3.tar.gz
(33.0 kB
view hashes)
Built Distribution
pybuildit-0.0.3-py3-none-any.whl
(40.4 kB
view hashes)
Close
Hashes for pybuildit-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98831ba97aae4e499da21a8095f800b494642500eb4c101a1cd42cecbc7ec48d |
|
MD5 | 6804644a8d3ee4ebd31d7a0176ff4f2a |
|
BLAKE2b-256 | 6089a10947f648ce8518525e8f176de5268611ea3a1e13b4258f33f0ccb3213e |