%% Generate Dependencies for User-defined Gazebo Custom Message
% This example shows how to generate dependencies for user-defined gazebo custom message.
% Create a folder in the local directory.

folderPath = fullfile(pwd,'customMessage')
mkdir(folderPath)

% Create one or more '.proto' file inside the folder and define protobuf custom message fields.

messageDefinition = {'message MyPose'
                     '{'
                     '   required double x = 1;'
                     '   required double y = 2;'
                     '   required double z = 3;'
                     '}'};
fileID = fopen(fullfile(folderPath,'MyPose.proto'),'w');
fprintf(fileID,'%s\n',messageDefinition{:}) ;
fclose(fileID);

% Run the gazebogenmsg function and specify the folder path.

gazebogenmsg(folderPath)

% Run the following commands to add and save the install path.

%addpath(fullfile(folderPath,'install'))
%savepath

% Create Gazebo plugin package 'MyPlugin' inside the custom message folder using the packageGazeboPlugin function.

packageGazeboPlugin(fullfile(folderPath,'MyPlugin'),folderPath)

% Copyright 2020 The MathWorks, Inc.