<style>
/* basic design */
.reveal h1, .reveal h2, .reveal h3, .reveal h4, .reveal h5, .reveal h6,
.reveal section, .reveal table, .reveal li, .reveal blockquote, .reveal th, .reveal td, .reveal p {
font-family: 'Meiryo UI', 'Source Sans Pro', Helvetica, sans-serif, 'Helvetica Neue', 'Helvetica', 'Arial', 'Hiragino Sans', 'ヒラギノ角ゴシック', YuGothic, 'Yu Gothic';
text-align: left;
line-height: 1.6;
letter-spacing: normal;
text-shadow: none;
word-wrap: break-word;
color: #444;
}
.reveal h1, .reveal h2, .reveal h3, .reveal h4, .reveal h5, .reveal h6 {font-weight: bold;}
.reveal h1, .reveal h2, .reveal h3 {color: #2980b9;}
.reveal th {background: #DDD;}
.reveal section img {background:none; border:none; box-shadow:none; max-width: 95%; max-height: 95%;}
.reveal blockquote {width: 90%; padding: 0.5vw 3.0vw;}
.reveal table {margin: 1.0vw auto;}
.reveal code {line-height: 1.2;}
.reveal p, .reveal li {padding: 0vw; margin: 0vw;}
.reveal .box {margin: -0.5vw 1.5vw 2.0vw -1.5vw; padding: 0.5vw 1.5vw 0.5vw 1.5vw; background: #EEE; border-radius: 1.5vw;}
/* table design */
.reveal table {background: #f5f5f5;}
.reveal th {background: #444; color: #fff;}
.reveal td {position: relative; transition: all 300ms;}
.reveal tbody:hover td { color: transparent; text-shadow: 0 0 3px #aaa;}
.reveal tbody:hover tr:hover td {color: #444; text-shadow: 0 1px 0 #fff;}
/* blockquote design */
.reveal blockquote {
width: 90%;
padding: 0.5vw 0 0.5vw 6.0vw;
font-style: italic;
background: #f5f5f5;
}
.reveal blockquote:before{
position: absolute;
top: 0.1vw;
left: 1vw;
content: "\f10d";
font-family: FontAwesome;
color: #2980b9;
font-size: 3.0vw;
}
/* font size */
.reveal h1 {font-size: 5.0vw;}
.reveal h2 {font-size: 4.0vw;}
.reveal h3 {font-size: 2.8vw;}
.reveal h4 {font-size: 2.6vw;}
.reveal h5 {font-size: 2.4vw;}
.reveal h6 {font-size: 2.2vw;}
.reveal section, .reveal table, .reveal li, .reveal blockquote, .reveal th, .reveal td, .reveal p {font-size: 2.2vw;}
.reveal code {font-size: 1.6vw;}
/* new color */
.red {color: #EE6557;}
.blue {color: #16A6B6;}
/* split slide */
#right {left: -18.33%; text-align: left; float: left; width: 50%; z-index: -10;}
#left {left: 31.25%; text-align: left; float: left; width: 50%; z-index: -10;}
</style>
<style>
/* specific design */
.reveal h2 {
padding: 0 1.5vw;
margin: 0.0vw 0 2.0vw -2.0vw;
border-left: solid 1.2vw #2980b9;
border-bottom: solid 0.8vw #d7d7d7;
}
</style>
<!-- --------------------------------------------------------------------------------------- -->
<br/>
# RustでROS2
<br/>
<br/>
#### 2020.10.26
### 岡本拓海
---
<br/>
<br/>
ros2-rustを動かしてみた報告と理解ができていない部分のまとめです。
---
## 環境
- OS Ubuntu 20.04
- ROS **FoxyFitzroy**
- (Dashingでは何個かヘッダが見つからずビルドエラー)
- rustc 1.46.0
- cargo 1.46.0
---
## Rustのインストール
下記コマンドでインストールできます。
```bash
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他必要なツールをインストールします。
```bash
$ sudo apt install python3-vcstool libclang-dev clang
```
---
## ソースコードのインポート
下記のコマンドでros2 rustのソースコードをインポートします
```bash
$ mkdir -p ros2_rust_ws/src
$ cd ros2_rust_ws
$ wget https://raw.githubusercontent.com/ros2-rust/ros2_rust/master/ros2_rust.repos
$ vcs import src < ros2_rust.repos # .repoファイル内のリポジトリを探してきてsrcにインポート
```
---
## ビルド
あとは、いつものようにros2のビルドをすれば良いだけ。
```bash
source /opt/ros/foxy/setup.sh
colcon build
```
---
## 実行
### Publisher端末
```bash
source ./install/setup.sh
ros2 run rclrs_examples rclrs_publisher
```
### Subscriber端末
```bash
source ./install/setup.sh
ros2 run rclrs_examples rclrs_subscriber
```
---
## 実行結果

---
## この辺分からん
サンプル動かしてみただけなので、まだちゃんと読んでませんが、以下の部分理解してなかったり、知識不足です。。知ってる方いたら教えてください。。。。
- ros2/common_interfaces, ros2/rcl_interfaces, ros2/rosidl_defaultsの3つのリポジトリの役割
- おそらくidlの生成とかrclを自前で作るのに必要なリポジトリっぽい。あとで調べる
- この辺の資料知ってる人居たら、コメント貰えると嬉しいです
- rcls_examplesのCargo.tomlにrclrsについての記述が無い(なぜ?)
- cmakeがcargoを叩いているのでこうなっているそうです
---
## 参考
ros2-rustのリポジトリ https://github.com/ros2-rust/ros2_rust
{"metaMigratedAt":"2023-06-15T14:44:47.997Z","metaMigratedFrom":"YAML","title":"RustでROS2","breaks":true,"slideOptions":"{\"theme\":\"white\",\"slideNumber\":\"c/t\",\"center\":false,\"transition\":\"none\",\"keyboard\":true,\"width\":\"93%\",\"height\":\"100%\"}","contributors":"[{\"id\":\"610cfd52-ad2b-46e8-81e2-a79a85a7f06f\",\"add\":4425,\"del\":3351}]"}