O'Reilly logo

Mastering ROS for Robotics Programming - Second Edition by Jonathan Cacace, Lentin Joseph

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Publishing a ROS message in Simulink

To publish a ROS message in Simulink, we mainly need two blocks:

  • Publish: This block sends a message on the ROS network. Using block parameters, we can specify the topic name and the message type.
  • Blank message: This block creates a blank message with the specified message type.

Let's see how to connect these blocks to publish a geometry_msgs/Twist message on a new topic, called /position. Get started by importing the blank message block from the library browser and configuring the type of message by double-clicking on it. From the block parameters pane, we can press the Select button to select the ROS message type from a list, as shown in the following screenshot:

Figure 15: Parameter configuration ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required