0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

uArm Metal 指南書 ~とりあえず動くところまで~

Posted at

パソコンとの接続方法

  • microUSBケーブル
    uArm Metal の背面にある microUSB ポートとパソコンを接続します。
  • 5VAC アダプタ
    電源アダプタ(5VAC)を uArm Metal の電源ジャックに接続

pyArm をインストール

  1. GitHub からソースをクローンまたは ZIP をダウンロード
    git clone https://github.com/uArm-Developer/pyuarm.git ~/Downloads/pyuarm-dev
    
    
    

インタプリタでの動作確認

>>> import pyuarm
>>> print(pyuarm.__version__)        # 例: 2.4.0.12
>>> from pyuarm import UArm, get_uarm
>>> arm = get_uarm()                 # 自動検出
>>> arm.connect()
>>> arm.set_position(150, 0, 50)     # X, Y, Z 移動
>>> arm.set_wrist(45)                # 手首サーボ 45°
>>> arm.set_pump(True)               # ポンプ ON
>>> arm.set_pump(False)              # ポンプ OFF
>>> pos = arm.get_position()         # 現在位置取得
>>> arm.disconnect()

CLI ツール

python -m pyuarm.tools.calibrate

##サンプルコード


"""
move_uArm.py
"""

import sys
import time
from pyuarm import UArm, get_uarm

def main():
 arm = get_uarm()
 if arm is None:
     print("ERROR: uArm が見つかりません。")
     sys.exit(1)

 arm.connect()
 print(f"Connected: FW={arm.firmware_version}, HW={arm.hardware_version}")

 try:
     arm.set_position(200, 250, 150, wait=True)
     arm.set_wrist(45, wait=True)    
     arm.set_pump(True, wait=True)
     time.sleep(1)
     arm.set_pump(False, wait=True)
     arm.set_position(0, 150, 150, wait=True)

     x, y, z = arm.get_position()
     print(f"Pos: X={x:.1f}, Y={y:.1f}, Z={z:.1f}")
 finally:
     arm.disconnect()
     print("Disconnected.")

if __name__ == "__main__":
 main()

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?