I have the following folder structure for my custom messages in the package folder core_msg:
/user_folder/core_msg/msg
/user_folder/core_msg/srv
/user_folder/core_msg/package.xml
Then, to create the files MATLAB needs to use the custom services and message from core_msg, I call rosgenmsg with the path to user_folder.
After setting up MATLAB to use my custom services and messages, when I call
rosservice info /NameOfService
from inside MATLAB on my custom service /NameOfService defined in /user_folder/core_msg/srv, I get the following error:
Cannot find a MATLAB message class for type core_srv/NameOfService.
However, when I use the same command from a terminal, I am able to successfully get information, including the Type, which is correctly identified as core_srv/NameOfService.
I have also noticed that in matlab_gen\+robotics\+ros\+custom\+msggen\CustomMsgConsts.m, all of my services begin with the wrong message type (core_msg) instead of the expected one (core_srv).
Why do my custom services or messages begin with the incorrect ROS message type in MATLAB but not in a terminal?
Best Answer