Publish
Send messages to ROS network
Libraries:
ROS Toolbox /
ROS
Description
The Publish block takes in as its input a Simulink® nonvirtual bus that corresponds to the specified ROS message type and publishes it to the ROS network. It uses the node of the Simulink model to create a ROS publisher for a specific topic. This node is created when the model runs and is deleted when the model terminates. If the model does not have a node, the block creates one.
On each sample hit, the block converts the Msg input from a Simulink bus signal to a ROS message and publishes it. The block does not distinguish whether the input is a new message but merely publishes it on every sample hit. For simulation, this input is a MATLAB® ROS message. In code generation, it is a C++ ROS message.
Examples
Ports
Input
Parameters
Tips
You can also set the addresses for the ROS master and node host by clicking the Configure network addresses link in the block.
Extended Capabilities
Version History
Introduced in R2019b