Main Content

Simulink 内の ROS

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

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

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

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

関数

すべて展開する

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

ブロック

すべて展開する

Blank Message指定されたメッセージ タイプを使用した空白メッセージの作成
Call ServiceCall service in ROS network
Current TimeRetrieve current ROS time or system time
Get ParameterGet values from ROS parameter server
PublishSend messages to ROS network
Read DataPlay back data from log file
Read ImageExtract image from ROS Image message
Read Point CloudExtract point cloud from ROS PointCloud2 message
Set ParameterSet values on ROS parameter server
SubscribeReceive messages from ROS network
Blank MessageCreate blank ROS 2 message using specified message type
PublishSend messages to ROS 2 network
SubscribeReceive messages from ROS 2 network

トピック

ROS ネットワーク

ROS Simulink Support and Limitations

The ROS Toolbox does not support the following ROS features in Simulink:

Get Started with ROS in Simulink®

This example shows how to use Simulink blocks for ROS to send and receive messages from a local ROS network.

Configure ROS Network Addresses

Configure ROS Network Addresses Dialog

Connect to a ROS-enabled Robot from Simulink®

You can use Simulink to connect to a ROS-enabled physical robot or to a ROS-enabled robot simulator such as Gazebo. This example shows how to:

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®

This example illustrates how to work with complex ROS messages in Simulink, such as messages with nested sub-messages and variable-length arrays.

Select ROS Topics, Messages, and Parameters

Dialog box descriptions for selection ROS topics and messages.

Manage Array Sizes for ROS Messages in Simulink

Description of dialog box for managing array sizes in Simulink ROS

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.

Publish and Subscribe to ROS 2 Messages in Simulink

This model shows how to publish and subscribe to a ROS 2 topic using Simulink®.

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.

ロボット アプリケーション

Generate a Standalone ROS Node from Simulink®

This example shows you how to generate and build a standalone ROS node from a Simulink model.

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 in MATLAB

This example shows you how to use MATLAB® to control a simulated robot running on a separate ROS-based simulator over a ROS network. The example shown here uses ROS and MATLAB. For the other examples with ROS 2 or Simulink®, see:

Automated Parking Valet with ROS in MATLAB

This example shows how to distribute the Automated Parking Valet (Automated Driving Toolbox) application among various nodes in a ROS network. Depending on your system, this example is provided for ROS and ROS 2 networks using either MATLAB® or Simulink® . The example shown here uses ROS and MATLAB. For the other examples, see:

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

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