ROS custom message listed but Matlab fails to create message/pu​blisher/su​bscriber

9 views (last 30 days)
Hi everybody,
I use MATLAB2020a under Win10 and use rosgenmsg to use grid_map messages in Matlab.
  1. I created the custom message as stated in the documentation (I had to add two build dependencies in grid_map_msgs package.xml though)
  2. The new custom messages are visible if I exected rosmsg list, e.g. the message type 'grid_map_msgs/GridMap':
If I now want to create a message I get the following error:
>> rosmessage('grid_map_msgs/GridMap')
Cannot find a MATLAB message class for type grid_map_msgs/GridMap.
Also, if I create an publisher (rosinit works, connected to master), I get the following error:
>> pub = rospublisher('/MyTest', 'grid_map_msgs/GridMap');
Failed to create a publisher with topic name /MyTest and type grid_map_msgs/GridMap.
Same applies for a subscriber.
Does anybody have an idea why this does not work, even though the custom messages are listed in Matlab correctly?
Best regards,
Emanuel

Accepted Answer

Emanuel Staudinger
Emanuel Staudinger on 11 Nov 2020
Hi everybody,
I figured out the root of the problem: I did not check the system requirements carefully. On Win10 I needed Python 2.7 and Cmake 3.15.5+. After recreating the messages with rosgenmsg I also got more outputs during the process: e.g., that I have to add the absolute paths of the jar-files to the javaclasspath text-file.
Now it works.
Cheers,
Emanuel
  1 Comment
Jagadeesh Konakalla
Jagadeesh Konakalla on 11 Nov 2020
Hi Emanuel,
Good to know that it is working. I am hoping that updating the matlab path and java path, then restarting the MATLAB should have worked for you.
If you are using R2020a version of MATLAB, you do not need Python 2.7 and CMAKe for custom message generation. From R2020b onwars, you need python and CMAKe.
Please follow the following links for R2020a custom message support.
Let me know if you need further assitance on this.
Thanks,
Jagadeesh

Sign in to comment.

More Answers (0)

Categories

Find more on Custom Message Support in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!