In this section, we will discuss how to publish and subscribe ROS messages using MATLAB scripts. The first script that we analyze defines a typical template to develop the control loop of our robot. Firstly, we will subscribe to an input topic, and, successively, we will republish its value on an output topic for a certain amount of time. The complete source code is contained in the talker.m, in the code provided with the book, or you can clone the following Git repository:
$ git clone https://github.com/jocacace/ros_matlab_test
Let's see the content of the talker.m script:
ros_master_ip = 'http://192.168.1.5:11311'; matlab_ip = '192.168.1.13'; rosinit(ros_master_ip, 'NodeHost', matlab_ip); ...