Main Content

ROS in Simulink

Access ROS networks and messages using Simulink®

ROS Toolbox enables you to connect to ROS and ROS 2 in Simulink and send messages over the network. See Get Started with ROS in Simulink.

You can also generate and deploy code to a target system. For an advanced example on creating a standalone ROS node, see Generate a Standalone ROS Node from Simulink.

To run, stop, or check the status of deployed ROS nodes available on a ROS device, use the MATLAB® functions listed. Create a connection to a ROS device using rosdevice.

Note

ROS blocks are not supported for usage within subsystem references. This is because ROS Toolbox uses a data dictionary to store model information but subsystem reference does not support portability of data dictionary attached to it. For more information on using subsystem references, see Considerations When Using a Library Dictionary (Simulink).

Functions

expand all

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

Blocks

expand all

Blank MessageCreate blank message using specified message type
Call ServiceCall service in ROS network
Current TimeRetrieve current ROS time or system time
Get ParameterGet values from ROS parameter server
Header AssignmentUpdate fields of ROS message header
PublishSend messages to ROS network
Read DataPlay back data from log file
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

Topics

ROS Network

ROS Messages

ROS Applications

Model Execution