LoginSignup
6
0

More than 3 years have passed since last update.

ros2-rust動かしてみた

Last updated at Posted at 2020-08-30

ros2-rustを動かしてみた報告と理解ができていない部分のまとめです。

(自分でもコミットできるかと思ったのですが、理解してない部分が多くて先に進めぬ。。。)

環境

  • OS Ubuntu 20.04
  • ROS FoxyFitzroy (Dashingでは何個かヘッダが見つからずビルドエラー)
  • rustc 1.46.0
  • cargo 1.46.0

準備

Rustのインストール

下記コマンドでインストールできます。

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

インストール時に以下の画面出ますが1を選んでください。

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>

スクリプトがPATHを勝手に通してくれるのですが、一旦ログアウトしないと適用されないので、ログアウト&ログインしてください。

使用ツールのインストール

vcstool他必要なツールをインストールします。

sudo apt install python3-vcstool libclang-dev clang git

ソースコードのインポート

(2020/10/29修正 wgetだけじゃインポートできなくなってた)

mkdir -p ~/ros2_rust_ws/src/ros2-rust
cd ~/ros2_rust_ws/src/ros2-rust
git clone https://github.com/ros2-rust/ros2_rust.git
cd ../../
vcs import src < src/ros2-rust/ros2_rust/ros2_rust.repos

ビルド

あとは、いつものようにros2のビルドをすれば良いだけ。

source /opt/ros/foxy/setup.sh
colcon build

実行

Publisher端末

source ./install/setup.sh
ros2 run rclrs_examples rclrs_publisher

Subscriber端末

source ./install/setup.sh
ros2 run rclrs_examples rclrs_subscriber

実行結果はこんな感じ。

コメント 2020-08-30 113634.png

この辺分からん

サンプル動かしてみただけなので、まだちゃんと読んでませんが、以下の部分理解してなかったり、知識不足です。。

知ってる方いたら教えてください。。。。

  • ros2/common_interfaces, ros2/rcl_interfaces, ros2/rosidl_defaultsの3つのリポジトリの役割
    • おそらくidlの生成とかrclを自前で作るのに必要なリポジトリっぽい。あとで調べる
    • この辺の資料知ってる人居たら、コメント貰えると嬉しいです
  • rcls_examplesのCargo.tomlにrclrsについての記述が無い(なぜ?)
    • おそらくammentやcolconの都合でこうなってるんだろうけど。。ぱっと見不自然。。

参考

ros2-rustのリポジトリ https://github.com/ros2-rust/ros2_rust

6
0
2

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
6
0