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 2 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
|Blank Message||Create blank message using specified message type|
|Call Service||Call service in ROS network|
|Current Time||Retrieve current ROS time or system time|
|Get Parameter||Get values from ROS parameter server|
|Publish||Send messages to ROS network|
|Read Data||Play back data from log file|
|Read Image||Extract image from ROS Image message|
|Read Point Cloud||Extract point cloud from ROS PointCloud2 message|
|Set Parameter||Set values on ROS parameter server|
|Subscribe||Receive messages from ROS network|
The ROS Toolbox does not support the following ROS features 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 Dialog
You can use Simulink to connect to a ROS-enabled physical robot or to a ROS-enabled robot simulator such as Gazebo.
Details for setting ROS parameters in Simulink.
Parameters for connecting to a ROS device.
Simulink and ROS Interaction Overview
This example illustrates how to work with complex ROS messages in Simulink, such as messages with nested sub-messages and variable-length arrays.
Dialog box descriptions for selection ROS topics and messages.
Description of dialog box for managing array sizes in Simulink ROS
This example shows how to use Simulink blocks for ROS 2 to send and receive messages from a local ROS 2 network.
This model shows how to publish and subscribe to a ROS 2 topic using Simulink®.
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.
This example shows you how to generate and build a standalone ROS node from a Simulink model.
This example shows you how to generate and build a standalone ROS 2 node from a Simulink® model.
This example shows you how to use Simulink® to control a simulated robot running in a Gazebo® robot simulator over ROS 2 network.
This example shows you how to use MATLAB® to control a simulated robot running on a separate ROS-based simulator over a ROS network.
This example shows how to distribute the Automated Parking Valet (Automated Driving Toolbox) application among various nodes in a ROS network.
This example shows you how to generate C++ code from a Simulink model to deploy as a standalone ROS node.
This example shows you how to generate C++ code from a Simulink® model to deploy as a standalone ROS 2 node.
External mode enables Simulink on your host computer to communicate with a deployed model on your robotics hardware during runtime.
You can enable a deployed ROS node to execute based on the time published on the
/clock topic on a ROS network.
External mode enables Simulink models on your host computer to communicate with a deployed model on your robot hardware during runtime.