Hi Federico,
The above error message may be caused by certain paths being present in your "PATH" variable and/or other environment variables on your system. For example, if a native "ROS 2" installation is present, there might be a library conflict between it and MATLAB’s "ROS 2" libraries.
To avoid this potential issue, inspect the value of your "PATH" environment variable by entering the following command at the MATLAB Prompt:
The idea is to remove potential problematic paths from "PATH" within MATLAB. In particular, remove entries such as:
To set a new "PATH" environment variable for your MATLAB session, use the following commands:
>> newPath = '/usr/local/MATLAB/R2023b/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin';
>> setenv('PATH', newPath)
If shortening "PATH" within MATLAB does not help, look out for other environment variables that may interfere with "ROS 2" libraries, such as "RMW_IMPLEMENTATION". Enter the following command at the MATLAB Prompt to get a list of all set environment variables:
If you find "RMW_IMPLEMENTATION" in this list, you can unset it in MATLAB by using the following command:
>> setenv('RMW_IMPLEMENTATION', '')
You may refer to the following MathWorks documentation links to have a better understanding on ROS 2 and creating custom messages:
- https://www.mathworks.com/help/releases/R2023b/ros/ref/ros2.html
- https://www.mathworks.com/help/releases/R2023b/ros/ug/ros2-custom-message-support.html