Main Content

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 デバイスへの接続を作成します。

関数

すべて展開する

rosdeviceConnect to remote ROS device
runNodeStart ROS or ROS 2 node
stopNodeStop ROS or ROS 2 node
runCoreStart ROS core
stopCoreStop ROS core
isNodeRunningDetermine if ROS or ROS 2 node is running
isCoreRunningDetermine if ROS core is running

ブロック

すべて展開する

Blank Message指定されたメッセージ タイプを使用した空白メッセージの作成
Call ServiceCall service in ROS network
Current Time現在の ROS 時間またはシステム時間の取得
Get ParameterGet values from ROS parameter server
Header AssignmentUpdate fields of ROS message header
PublishROS ネットワークへのメッセージの送信
Read Dataログ ファイルからのデータの再生
Read ImageExtract image from ROS Image message
Read ScanExtract scan data from ROS or ROS 2 laser scan message
Read Point CloudExtract point cloud from ROS PointCloud2 message
Set ParameterSet values on ROS parameter server
SubscribeReceive messages from ROS network
Write ImageWrite image data to a ROS or ROS 2 message
Write Point CloudWrite point cloud data to a ROS or ROS 2 message

トピック

ROS ネットワーク

ROS メッセージ

ROS アプリケーション

  • Generate a Standalone ROS Node from Simulink
    This example shows you how to 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
    This example shows how to 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®. 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 dynamics parameters before partitioning the model into ROS nodes.
  • 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.

モデルの実行

  • 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.