Simulink 内の ROS 2
Simulink® を使用して ROS 2 のネットワークおよびメッセージにアクセスする
ROS Toolbox を使用して、ROS および ROS 2 に Simulink 内で接続し、ネットワーク経由でメッセージを送信できます。Get Started with ROS 2 in Simulink®を参照してください。
また、コードを生成してターゲット システムに展開することもできます。スタンドアロンの ROS 2 ノードの作成に関する高度な例については、Generate a Standalone ROS 2 Node from Simulinkを参照してください。
ROS 2 デバイス上で使用可能な展開済みの ROS 2 ノードの実行、停止、またはステータス チェックを行うには、リストにある MATLAB® 関数を使用します。ros2device
を使用して ROS デバイスへの接続を作成します。
関数
ブロック
Blank Message | 指定されたメッセージ タイプを使用した空白の ROS 2 メッセージの作成 |
Call Service | Call service in ROS 2 network |
Current Time | Retrieve current ROS 2 time or system time |
Get Parameter | Get ROS 2 parameter value |
Publish | Send messages to ROS 2 network |
Read Data | Play back data from ROS 2 log file |
Read Image | Extract image from ROS 2 Image message |
Read Scan | Extract scan data from ROS or ROS 2 laser scan message |
Read Point Cloud | Extract point cloud from ROS 2 PointCloud2 message |
Subscribe | Receive messages from ROS 2 network |
Write Image | Write image data to a ROS or ROS 2 message |
Write Point Cloud | Write point cloud data to a ROS or ROS 2 message |
トピック
ROS 2 ネットワーク
- Get Started with ROS 2 in Simulink®
This example shows how to use Simulink blocks for ROS 2 to send and receive messages from a local ROS 2 network. - Simulink での ROS 2 メッセージのパブリッシュとサブスクライブ
このモデルでは、Simulink® を使用して ROS 2 トピックをパブリッシュおよびサブスクライブする方法を示します。 - Connect to a ROS-Enabled Robot from Simulink® over ROS 2
This example shows you how to configure a Simulink model to send and receive information from a separate ROS-based simulator such as Gazebo® over ROS 2.
ROS 2 メッセージ
- Work with ROS 2 Messages in Simulink
This example illustrates how to work with complex ROS 2 messages in Simulink®, such as messages with nested sub-messages and variable-length arrays. - Simulink での ROS メッセージの配列サイズの管理
Simulink で ROS の配列サイズを管理するためのダイアログ ボックスの説明
ROS 2 アプリケーション
- Generate a Standalone ROS 2 Node from Simulink
This example shows you how to generate and build a standalone ROS 2 node from a Simulink® model. You configure a model to generate C++ code for a standalone ROS 2 node. Then, build and run the ROS 2 node on your host computer. - Feedback Control of a ROS-Enabled Robot Over ROS 2
This example shows you how to use Simulink® to control a simulated robot running in a Gazebo® robot simulator over ROS 2 network. - Sign Following Robot with ROS 2 in Simulink
Use Simulink® to control a simulated robot running on a separate ROS-based simulator over ROS 2 network. - Automated Parking Valet with ROS 2 in Simulink
This example shows how to distribute the Automated Parking Valet application among various nodes in a ROS 2 network in Simulink® and deploy them as standalone ROS 2 nodes. This example extends the Automated Parking Valet (Automated Driving Toolbox) example in the Automated Driving Toolbox™. Using the Simulink model in the Automated Parking Valet in Simulink example, tune the planner, controller and vehicle dynamic parameters before partitioning the model into ROS 2 nodes. - Generate Code to Manually Deploy a ROS 2 Node from Simulink
This example shows you how to generate C++ code from a Simulink® model to deploy as a standalone ROS 2 node. The code is generated on your computer and must be manually transferred to the target ROS device. No connection to the hardware is necessary for generated the code. For an automated deployment of a ROS 2 node, see Generate a Standalone ROS 2 Node from Simulink.
モデルの実行
- Enable ROS 2 Time Model Stepping for Deployed Nodes
You can enable a deployed ROS 2 node to execute based on the time published on the/clock
topic on a ROS 2 network. To deploy a ROS 2 node from Simulink, see Generate a Standalone ROS 2 Node from Simulink.