Simple Publisher

The following code will publish ten messages to the topic chatter. The parameters of the rosClopemaPublishOnTopic are:
  • Topic name.
  • Message type. (pkg_name/msg)
  • Message which will be published.
%% Init (addpath)
clc;clear all;close all;
[voopRes voopT] = system('echo $ROS_WORKSPACE');
addpath(genpath([strcat(voopT) '/clopema_matlab/matlab/']));
clear voopRes voopT

%%
for i = 1:10
    text = ['test' int2str(i)];
    fprintf(text);
    fprintf('\n');
    rosClopemaPublishOnTopic('chatter','std_msgs/String',struct('data',text))    
    pause(0.5);
end