Select ROS Topics, Messages, and Parameters
Select ROS Topics
When using Simulink® with ROS, you can publish or subscribe to topics on the ROS network. In the dialog boxes for the Publish and Subscribe blocks, you can select from a list of topics on the ROS network. You must be currently connected to a ROS network to get a list of topics. You can select a topic using the following:
This dialog shows the list of topics available on the ROS master. Selecting a topic from the list automatically populates the Topic and Message type parameters for the corresponding block mask dialog. If the message type is not supported in MATLAB® ROS, Simulink will throw an error. Once the topic is selected, it is saved with the block. Even if the topic is not longer available on the network, the block will still use that topic name.
To refresh the list, close and open the dialog again.
To use a topic not currently posted on the ROS network or if you are not currently connected, use the “Specify your own” option under the Topic Source parameter in your block mask dialog.
Select ROS Message Types
This is the list of all message types supported in MATLAB ROS including any custom message types. You can begin typing in the name of your desired message type or manually search through the list.
The selected message type is stored with the block and saved with the model.
Note: When using code generation, message type information is not included. You must ensure that your Linux ROS environment has the ROS packages installed that contain the necessary message type definitions.
Select ROS Parameter Names
When using the Get Parameter and Set Parameter blocks, you have the option of "Select from ROS Network" in the block parameters, which gets a list of parameters currently on the server. When clicking Select, you should see this dialog box.
This is the list of parameters you can select from the ROS parameter server. The parameters that are grayed out have unsupported data types. Select a parameter name that is not grayed out and click OK. This should auto-fill the Name and Data type into the block parameters.