3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ROBOTIS サーボモータ DynamixelをROS2で操作する

Last updated at Posted at 2022-04-19

はじめに

ROS2でROBOTIS Dynamixelを動かすための、セットアップおよび実際に動作させるまでについて記述します。

実行環境

コンピュータ

デバイス Raspberry Pi 4
RAM 8GB
OS Ubuntu 20.04LTS
ROS2 Foxy Fitzroy

アクチュエータ(Dynamixel)

メーカー ROBOTIS
シリーズ XM430-W350
詳細 https://emanual.robotis.com/docs/en/dxl/x/xm430-w350/

環境構築

DynamixelSDKのインストール

DynamixelSDK(Dynamixcelを扱うためのパッケージ)を特定のワークスペースにインストールしてビルドしてください。

$ mkdir -p ~/hogehoge_ws/src
$ cd ~/hogehoge_ws/src
$ git clone -b $ROS_DISTRO-devel https://github.com/ROBOTIS-GIT/DynamixelSDK
$ cd ~/robotis_ws && colcon build --symlink-install

サンプルプログラム

dynamixel_sdk_examples/srcにあるread_write_node.cppのデフォルトセッティングのうちボーレートとシリアル通信のデバイス名を変更してください。
スクリーンショット 2022-04-03 131010.png
デバイス名は以下のコマンドで確認できます。

$ ls /dev/ttyUSB

またDynamixelのボーレートやID等の情報はDYNAMIXEL Wizardから確認することができます。

動作確認

DynamixelSDKをインストールしたワークスペースからdynamixel_sdk_examplesのサンプルプログラムread_write_nodeを実行してください。

$ ros2 run dynamixel_sdk_examples read_write_node

idと位置をパブリッシュしてDynamixelを動かします。

$ ros2 topic pub -1 /set_position dynamixel_sdk_custom_interfaces/SetPosition "{id: 32, position: 1000}

上手くいくと動画のように動かせると思います。(動画ではポジションを0→1000に動かしています)

参考文献

3
1
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
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?