このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。
Simulink における ROS ネットワーク アクセス
Simulink® を使用して ROS のネットワークおよびメッセージにアクセスする
ROS Toolbox を使用して、ROS および ROS 2 に Simulink 内で接続し、ネットワーク経由でメッセージを送信できます。Get Started with ROS in Simulinkを参照してください。
また、コードを生成してターゲット システムに展開することもできます。スタンドアロンの ROS ノードの作成に関する高度な例については、Generate a Standalone ROS Node from Simulinkを参照してください。
ROS デバイス上で使用可能な展開済みの ROS ノードの実行、停止、またはステータス チェックを行うには、リストにある MATLAB® 関数を使用します。rosdevice
を使用して ROS デバイスへの接続を作成します。
メモ
サブシステム参照内での ROS ブロックの使用はサポートされていません。これは、ROS Toolbox はデータ ディクショナリを使用してモデル情報を保存しますが、サブシステム参照ではアタッチされたデータ ディクショナリの移植性がサポートされていないためです。サブシステム参照の使用の詳細については、Considerations When Using a Library Dictionary (Simulink)を参照してください。
ROS 2 ブロックは、ソフトウェアインザループ (SIL) およびプロセッサインザループ (PIL) のシミュレーションではサポートされていません。
関数
ブロック
ROS Apply Transform, ROS 2 Apply Transform | Transform input ROS or ROS 2 message to target frame (R2023b 以降) |
Blank Message | 指定されたメッセージ タイプを使用した空白メッセージの作成 (R2019b 以降) |
Call Service | Call service in ROS network (R2019b 以降) |
Current Time | 現在の ROS 時間またはシステム時間の取得 (R2019b 以降) |
Get Parameter | Get values from ROS parameter server (R2019b 以降) |
Get Transform | Get transformation between source and target frame from ROS network (R2023b 以降) |
Header Assignment | Update fields of ROS message header (R2021a 以降) |
Publish | ROS ネットワークへのメッセージの送信 (R2019b 以降) |
Read Data | ログ ファイルからのデータの再生 (R2019b 以降) |
Read Image | Extract image from ROS Image message (R2019b 以降) |
ROS Read Scan, ROS 2 Read Scan | Extract scan data from ROS or ROS 2 laser scan message (R2022a 以降) |
Read Point Cloud | Extract point cloud from ROS PointCloud2 message (R2019b 以降) |
Set Parameter | Set values on ROS parameter server (R2019b 以降) |
Subscribe | ROS ネットワークからメッセージを受信 (R2019b 以降) |
ROS Write Image, ROS 2 Write Image | Write image data to a ROS or ROS 2 message (R2022a 以降) |
ROS Write Point Cloud, ROS 2 Write Point Cloud | Write point cloud data to a ROS or ROS 2 message (R2022a 以降) |
トピック
ROS ネットワーク
- ROS Simulink Support and Limitations
The ROS Toolbox does not support the following ROS features in Simulink: - Get Started with ROS in Simulink
Use Simulink blocks for ROS to send and receive messages from a local ROS network. - ROS ネットワーク アドレスの構成
[ROS ネットワーク アドレスの構成] ダイアログ - Connect to a ROS-enabled Robot from Simulink
Configure Simulink to connect to a separate robot simulator using ROS and then send velocity commands, and receive position information from a simulated robot. - ROS Parameters in Simulink
Details for setting ROS parameters in Simulink. - Connect to ROS Device
Parameters for connecting to a ROS device. - ROS Simulink Interaction
Simulink and ROS Interaction Overview
ROS メッセージ
- Work with ROS Messages in Simulink
Work with complex ROS messages in Simulink, such as messages with nested sub-messages and variable-length arrays. - ROS のトピック、メッセージ、パラメーターの選択
ROS のトピックとメッセージを選択するためのダイアログ ボックスの説明。 - Log ROS Messages from Simulink to a Rosbag Logfile
Save ROS message data from Simulink to a rosbag file. - Use ROS Logger App to Save ROS Messages from Simulink
Use ROS Logger app to record ROS messages during Simulink simulation. - Simulink での ROS メッセージの配列サイズの管理
Simulink で ROS の配列サイズを管理するためのダイアログ ボックスの説明
ROS アプリケーション
- Generate a Standalone ROS Node from Simulink
Generate and build a standalone ROS node from a Simulink model. - Feedback Control of a ROS-Enabled Robot
Use Simulink to control a simulated robot running in a separate ROS-based simulator. - Sign-Following Robot with ROS in Simulink
Use Simulink to control a simulated robot running on a separate ROS-based simulator. - Automated Parking Valet with ROS in Simulink
Distribute an automated parking valet application among various nodes in a ROS network in Simulink. - Generate Code to Manually Deploy a ROS Node from Simulink
This example shows you how to generate C++ code from a Simulink model to deploy as a standalone ROS 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 node, see Generate a Standalone ROS Node from Simulink. - Emergency Braking of Ego Vehicle in CARLA Simulator Using Simulink and CARLA ROS Bridge
Emergency braking of ego vehicle in CARLA using Simulink.
モデルの実行
- Enable External Mode for ROS Toolbox Models
External mode enables Simulink on your host computer to communicate with a deployed model on your robotics hardware during runtime. External mode allows you to tune block mask parameters and to visualize signals on your model while your model is running. For ROS Toolbox, deployed models are ROS nodes running on the target hardware that communicates with Simulink over TCP/IP. - Enable ROS Time Model Stepping for Deployed ROS Nodes
You can enable a deployed ROS node to execute based on the time published on the/clock
topic on a ROS network. To deploy a ROS node from Simulink, see Generate a Standalone ROS Node from Simulink. - Tune Parameters and View Signals on Deployed Robot Models Using External Mode
External mode enables Simulink models on your host computer to communicate with a deployed model on your robot hardware during runtime. Use external mode to view signals or modify block mask parameters on your deployed Simulink model. Parameter tuning with external mode helps you make adjustments to your algorithms as they run on the hardware as opposed to in simulation in Simulink itself. This example shows how to use external mode with the Feedback Control of a ROS-Enabled Robot example when the model is deployed to the robot hardware. - Overrun Detection with Deployed ROS Nodes
You can enable overrun detection for a deployed ROS node. To deploy a ROS node from Simulink, see Generate a Standalone ROS Node from Simulink.