Please try out the following steps for troubleshooting:
1) Custom message folder must be on MATLAB path
As a first step, make sure that your custom message appears in the list returned by the command:
If this is not the case, it could mean that your custom message folder is not on the MATLAB path. You can achieve this by running the commands:\n
addpath('...\my_message\matlab_gen\msggen')
savepath
Then, restart MATLAB and confirm that the message appears in "rosmsg list", as shown below:
2) Generated JAR File must be on Java class pathIf the "rosmessage" command still fails, the next step is to make sure that the generated JAR file is contained in the MATLAB Java class path. To check this, enter the command:\nAt the very bottom of the list, there should be an entry pointing to your custom message folder:\n\nIf this is not the case, you need to create a javaclasspath.txt file. Use the following commands:\n\n>> cd(prefdir)
>> edit('javaclasspath.txt')
If you get the following prompt that the file doesn't exist and whether it should be created, click "Yes": Add the full path to the generated JAR file on a new line in the file:\nC:\MyDocuments\my_message\matlab_gen\jar\traffic_light-0.0.0.jar
Then, save the file and restart MATLAB. Now, the JAR file should appear on your javaclasspath, as shown below: Finally, ensure that you are using the correct spelling for your custom message when calling "rosmessage". For example, there should be no white spaces between the <package> and <type>.\n
>> rosmessage('traffic_light / Status')
>> rosmessage('traffic_light/status')
Once you double-checked the spelling, the "rosmessage" command should succeed:\n\n>> rosmessage('traffic_light/Status')
ans =
ROS Status message with properties:
MessageType: 'traffic_light/Status'
Color: ''
Duration: 0
Latitude: 0
Longitude: 0
Use showdetails to show the contents of the message