LoginSignup
3
2

More than 1 year has passed since last update.

9軸IMUモジュールWT901CをROS Foxyで使用する

Posted at

こちらの記事をみてWT901Cを購入したのですが、ROS1があまり得意ではないのでROS2に移植しました!

ROS2での動かし方

パッケージのインストール

今回作成したパッケージはこちら。
メッセージ、ドライバに関する部分はほぼそのまま移植し、ノードをROS2で動作するように書き換えています。

ros-foxy-ecl*をインストールします。

sudo apt install ros-foxy-ecl-devices \
                 ros-foxy-ecl-sigslots \
                 ros-foxy-ecl-time \
                 ros-foxy-ecl-build \
                 ros-foxy-ecl-geometry

リポジトリをクローンして、ビルドします。

source /opt/ros/foxy/setup.bash
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src
git clone -b ros2 https://github.com/fateshelled/wit_node
cd ~/ros2_ws
colcon build --symlink-install

WT901Cを接続

PCに接続して実行権限を付与します。

sudo chmod 666 /dev/ttyUSB0

起動

公式のROS1パッケージは可視化が面倒くさかったので、PoseStampedをPublishするように機能追加しています。
ROS2ノードのデフォルトボーレートは115200bpsです。WT901C側のボーレートと合致していないとデータが取得できないので気をつけましょう。この設定が一番のハマりどころかもしれません。

WT901C側のボーレート変更方法

source install/setup.bash
ros2 launch wit_node wit_visualize.launch.py

# ROS2ノードのボーレートを変更する場合
ros2 launch wit_node wit_visualize.launch.py baud_rate:=9600

おわりに

あくまで個人が作成した非公式なパッケージなのであしからず。
楽しいROS2ライフを!!

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