Subscribe
Receive messages from ROS network
Libraries:
ROS Toolbox /
ROS
Description
The Subscribe block creates a Simulink® nonvirtual bus that corresponds to the specified ROS message type. The block uses the node of the Simulink model to create a ROS subscriber 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 simulation step, the block checks if a new message is available on the specific topic. If a new message is available, the block retrieves the message and converts it to a Simulink bus signal. The Msg port outputs this new message. If a new message is not available, Msg outputs the last received ROS message. If a message has not been received since the start of the simulation, Msg outputs a blank message.
Examples
Ports
Output
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