メインコンテンツ

このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。

Simulink における ROS 2 ネットワーク アクセス

R2026a
Simulink® を使用して ROS 2 のネットワークおよびメッセージにアクセスする

ROS Toolbox を使用して、ROS および ROS 2 に Simulink 内で接続し、ネットワーク経由でメッセージを送信できます。Get Started with ROS 2 in Simulinkを参照してください。

また、コードを生成してターゲット システムに展開することもできます。スタンドアロンの ROS 2 ノードの作成に関する高度な例については、Generate Standalone ROS 2 Node from Simulinkを参照してください。

ROS 2 デバイス上で使用可能な展開済みの ROS 2 ノードの実行、停止、またはステータス チェックを行うには、リストにある MATLAB® 関数を使用します。ros2device を使用して ROS デバイスへの接続を作成します。

メモ

サブシステム参照内での ROS 2 ブロックの使用はサポートされていません。これは、ROS Toolbox はデータ ディクショナリを使用してモデル情報を保存しますが、サブシステム参照ではアタッチされたデータ ディクショナリの移植性がサポートされていないためです。サブシステム参照の使用の詳細については、ライブラリ ディクショナリを使用する場合の考慮事項 (Simulink)を参照してください。

ROS 2 ブロックは、ソフトウェアインザループ (SIL) およびプロセッサインザループ (PIL) のシミュレーションではサポートされていません。

関数

すべて展開する

ros2deviceConnect to remote ROS 2 device
runNodeStart ROS or ROS 2 node
stopNodeStop ROS or ROS 2 node
isNodeRunningDetermine if ROS or ROS 2 node is running

ブロック

ROS Apply Transform BlockApply TransformTransform input ROS or ROS 2 message to target frame (R2023b 以降)
Blank Message ROS 2 blockBlank Message指定されたメッセージ タイプを使用した空白の ROS 2 メッセージの作成
Call Service Block ROS 2Call ServiceCall service in ROS 2 network
ROS 2 CAN Transmit Block MaskCAN TransmitTransmit messages to controller area network (CAN) bus from ROS 2 network (R2026a 以降)
ROS 2 CAN Receive Block MaskCAN ReceiveReceive messages from controller area network (CAN) bus (R2026a 以降)
ROS 2 Cancel Action Goal block iconCancel Action GoalCancel active action goal in ROS 2 network (R2024a 以降)
ROS 2 Current TimeCurrent Time現在の ROS 2 時間またはシステム時間の取得 (R2022b 以降)
ROS 2 Get Parameter BlockGet ParameterGet ROS 2 parameter value (R2022b 以降)
ROS 2 Get Transform IconGet TransformGet transformation between source and target frame from ROS 2 network (R2023b 以降)
Header Assignment ROS 2 block icon.Header AssignmentUpdate fields of ROS 2 message header (R2023a 以降)
ROS 2 Monitor Action Goal block iconMonitor Action GoalMonitor action goal in ROS 2 network (R2024a 以降)
Publish ROS 2 blockPublishSend messages to ROS 2 network
Receive Service Request block icon.Receive Service RequestReceive service request from ROS 2 network (R2024a 以降)
Read Data ROS 2Read DataPlay back data from ROS 2 log file
Read Image ROS 2Read ImageExtract image from ROS 2 Image message
ROS Read Scan BlockRead ScanExtract scan data from ROS or ROS 2 laser scan message (R2022a 以降)
Read Point Cloud ROS 2Read Point CloudExtract point cloud from ROS 2 PointCloud2 message
ROS 2 Send Action Goal icon.Send Action GoalSend action goal messages to ROS 2 network (R2024a 以降)
Send Service Response block icon.Send Service ResponseSend service response to ROS 2 service client (R2024a 以降)
Subscribe ROS 2 blockSubscribeReceive messages from ROS 2 network by polling at each time step or processing immediately on arrival
ROS Write Image BlockWrite ImageWrite image data to a ROS or ROS 2 message (R2022a 以降)
ROS Write Point Cloud BlockROS Write Point Cloud, ROS 2 Write Point CloudWrite point cloud data to a ROS or ROS 2 message (R2022a 以降)

トピック

ROS 2 ネットワーク

ROS 2 メッセージ

ROS 2 アプリケーション

モデルの実行