岡本拓海
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- title: Native Rust components for ROS 2 in ROSCon 2022 tags: [ presentation, Rust, ROS 2, ROSCon] slideOptions: theme: white slideNumber: 'c/t' center: false transition: 'none' keyboard: true width: '93%' height: '100%' --- <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; text-transform:none; 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: 0.8vw 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 td {position: relative;} /* .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: 4.8vw;} .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 li, .reveal blockquote, .reveal p {font-size: 2.2vw;} .reveal table, .reveal th, .reveal td {font-size: 1.7vw;} .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> # Native Rust components for ROS2<br/>参加報告 ### in ROSCon 2022 ふりかえり会 <br/> 2022.11.21 岡本拓海 twitter: [@MrBearing2](https://twitter.com/MrBearing2) 資料URL https://hackmd.io/@MrBearing/SJPAMZG8s --- # TL;DR - この資料はNative Rust components for ROS2の参加報告です - 基本的に発表資料の和訳 - 多少のコメント #### 発表内容 - Rustでロボットプログラム書くの良いよ! - RustDDS + ros2-client でデモを作ったよ - FlexbotFrameworkというのを作ったよ --- # 元の発表資料リンク等 <br/> - :video_camera: [動画](https://vimeo.com/showcase/9954564/video/767140150) - [発表スライド pdf](http://download.ros.org/downloads/roscon/2022/Native%20Rust%20components%20for%20ROS2.pdf) -- pdfへの直接リンクなので注意 --- # 発表者について Juhana Helovuo さん - github:[jhelovuo](https://github.com/jhelovuo) - [Atostek](https://atostek.com/)のProduct Development /Chief Research Officer - フィンランドの会社 - RustDDSとros2-clientの開発元 - 遠隔医療や医療機器の管理システム等 <!-- ![](https://i.imgur.com/5NIh9rm.png)--> --- # Rustはなぜロボット向きの言語なのか - システムプログラミングに使える - C++のように低オーバッドでベアメタルなコードが書け、かつ高級言語(HaskelとかF#)の安全性が保障されてる - メモリ安全 - データ競合安全* - C++のプログラマにとっては学習が容易 - 代数的型システム - C/C++の悪い所(historical baggage)が無い - 未定義動作や処理系定義の動作 - 学習時の大量の落とし穴 <br/> <div style="font-size: 70%; color: black;"> * : スライドの下の方に"マジでコンパイラがデータ競合見つけてくれるぜ!!(でも、デッドロックはまだプログラマの責任だよ)"って小さく記述が。。 </div> ---- # Rustの特徴 - 所有権ベースのメモリーハンドリング - unsafe修飾子 - 危ない箇所をコード中で明示的に示せる e.g 生ポインタを扱う箇所等 - FFIを使ったり、低レベルのデータ構造を扱う場合などに必要になる - unsafeの適用箇所は非常に小さい範囲に留められる。 - LLVM上でコンパイラがビルドする - x86(-64),ARM,等のCPUアーキテクチャでもビルドできる --- # RustでのROS2クライアント一覧 | Name | Auther | Link | Notes | | -------- | -------- | -------- |-------- | | ros2-rust | 多数 | [ros2-rust](https://github.com/ros2-rust/ros2_rust) | 公式のrclのRustバインディング | | ros2-client / RustDDS | Atostek Oy / Juhana Helovuo and others |[RustDDS](https://github.com/jhelovuo/RustDDS) [ros2-client](https://github.com/jhelovuo/ros2-client) |  :arrow_left: **今回はコレの紹介**<br/> ネイティブRustのros2クライアントとDDSの実装 | | r2r | Martin Dahl and others | [r2r](https://github.com/sequenceplanner/r2r) | Rustのasyncブロック使えるようにしてました | | rclrust | Yuma Hiramatsu | [rclrust](https://github.com/rclrust/rclrust) | Rustのマクロ(!)でIDLとRustの型変換をやってる | | rus2 | Marshal SHI | [rus2](https://github.com/marshalshi/rus2) | 2020年の9月から開発止まってる | | rosrust | Adnan Ademovic and others | [rosrust](https://github.com/adnanademovic/rosrust) | ROS1用 (昔使ったけど結構ちゃんと動いた) ~~2020年の8月から止まってる~~ 今年の8月に更新あった | --- # Rust DDSとros2-clientの位置づけ <!-- ![](https://i.imgur.com/vroYzy3.png) --> <div align="center"> <img src="https://i.imgur.com/vroYzy3.png" height="700"> </div> ---- # Rust DDSについて - DDS APIとRTPSをネイティブRustでスクラッチ実装 - Apach 2.0ライセンスで公開中 - 特徴 - ピアを自動で発見 - ノンブロッキングI/O - 受信時はゼロコピー - 送信時はシングルコピー - Rustオブジェクトを直接シリアライズ/デシリアライズ可能 - 信頼性が高く、QoSはベストエフォート型 - [History QoS](https://www.omgwiki.org/ddsf/doku.php?id=ddsf:public:guidebook:06_append:glossary:h:history_qos) QoSポリシーの一つ - 大きなオブジェトの断片化が可能(?) ---- # Rust DDSのデモ eProsimaが出している[Shapes demo](https://www.eprosima.com/index.php/products-all/eprosima-shapes-demo)にRustDDSを使ってメッセージを送るデモ ![](https://i.imgur.com/10UsN15.png) [Qiitaで動作確認の記事](https://qiita.com/MrBearing/items/deb8077f79f6054edb2a)を書いたのでそちらをご参照ください。 <div style="font-size: 60%; color: black;"> スクリーンキャストで動画取ろうと頑張ったんですが、上手くいきませんでした。。。 </div> --- # ros2-client - やってる事は少ない 名前から名前の変換をして機能を隠しているだけ(?) - Rustで書かれたrclcpp , rclpy と同じようなレイヤーのソフトウェア - RustDDSの上で動作する - イベントループをまだ実装してないので、ノードは.poll()メソッドを使ってイベントループを自分で実装する必要がある ---- # ros2-clientを使ったコード例 [ros2-clientの/examples/listener/main.rs](https://github.com/jhelovuo/ros2-client/blob/58a732ea3b14d1e99de074e70a5acb55298deb70/examples/listener/main.rs#L42) ```rust=42 loop { // pollしたいリソースを渡す 第2引数はタイムアウト指定 metal I/O poll.poll(&mut events, None).unwrap(); //戻り値はResult for event in events.iter() { match event.token() { Token(1) => match chatter_subscription.take() { Ok(Some((message, _messafe_info))) => { let l = message.len(); println!("message len={} : {:?}", l, &message[..min(l,50)]); | } Ok(None) => println!("No message?!"), Err(e) => { println!(">>> error with response handling, e: {:?}", e) } }, _ => println!(">>> Unknown poll token {:?}", event.token()), } // match } // for } // loop ``` --- # FlexbotFrameworkについて1 - 2019年頃から開発しているロボットプログラミングのフレームワーク - まだオープンソースではない - "単一のソフトウェアそのものもノードと通信チャネルで構築したい” - 2020-2021年でROS2対応完了 ROS2の拡張機能としてみなせるレベル(自称) - Rustプログラミングをサポート - ソフトウェア全体が機械可読なデーターフロ仕様で記述される(Haskellらしい) - ボイラープレートコードは仕様書からの自動生成 - 蜜結合なノードがノード間の通信簡略化する(?) Closely coupled nodes can simplify inter-node communication - 数十~数百という細かい粒度でのデータフロープログラミングが可能 - 個々のノードは単純な構造にして再利用性を向上できる ---- # FlexbotFrameworkについて2 ![](https://i.imgur.com/L8Ff7gE.png) ---- # FlexbotFrameworkの実績について - Pulu Roboticsのロボットのコントロール(動画 17:48~) - 床面に設置したQRコードでのナビゲーション達成 - 三菱ロジスネクストのフォークリフトをROS2で操作(動画 19:00~) - フォークリフトのPLCとCAN経由で通信してフォークリフトを操作 --- # 会場であった質問 Q1 cargoからインストール可能? A1 できます。crates.ioからインストール可能です。 <br/> Q2 カスタムROSメッセージとのインタフェースはどうなってますか? A2 今の所は手動でRustのコードを書く必要があります。 部分的には対応するコードを自動的に吐くことができますが、万全ではありません。 --- # お願い - RustのBoF参加した方いましたら、BoFでのディスカッション内容とか補足してもらえると - 私は参加できなかった。。。 --- # お願い2 仕事探してます。 ROS/2が書きたいです!!! [![](https://i.imgur.com/CTXQs8O.png)](https://twitter.com/MrBearing2) 仕事やらしてもいいよって方は、@MrBearing2までDMください --- # 付録 - [RustDDSのデモのビルド&実行方法](https://qiita.com/MrBearing/items/deb8077f79f6054edb2a) --Qiita記事書きました --- # 参考資料 - https://github.com/jhelovuo/RustDDS - https://github.com/jhelovuo/ros2-client - - Shape demoの動かし方 - https://eprosima-shapes-demo.readthedocs.io/en/latest/ --- <br/><br/><br/><br/><br/> #### ご清聴ありがとうございました

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully