ROS2 Toolbox error when I try to add custom service/message
Show older comments
Hi Guys,
I have been facing this problem for some days when I try to change the parameters of the ROS2 blocks

Error: ros.slros2.internal.block.ServiceCallBlockMask.dispatch('serviceEdit',gcb) caused by: cell array input must be a cell array of character vectors
OS version: Ubuntu 22.04
Matlab version: 23.2.0.2599560 (R2023b) Update 8
4 Comments
federico ciresola
on 12 Jul 2024
Edited: federico ciresola
on 12 Jul 2024
federico ciresola
on 12 Jul 2024
Jagadeesh Konakalla
on 12 Jul 2024
Hi Federico,
Can you describe more about your workflow ?
I would like to know which version of MATLAB that you are using. Please note that ros2RegisterMessages works only on same OS platform and same release of MATLAB. Also let me know how you created custom message generation on other machine.
Thanks,
Jagadeesh K.
federico ciresola
on 25 Jul 2024
Answers (1)
Abhas
on 3 Sep 2024
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:
>> getenv('PATH')
The idea is to remove potential problematic paths from "PATH" within MATLAB. In particular, remove entries such as:
/opt/ros/foxy/bin;
/usr/local/bin;
/usr/bin;
/bin;
/usr/sbin;
/sbin;
To set a new "PATH" environment variable for your MATLAB session, use the following commands:
% minimum example of a new PATH variable
>> newPath = '/usr/local/MATLAB/R2023b/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin';
>> setenv('PATH', newPath)
>> ros2node('/test1')
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:
>> system('printenv')
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:
Categories
Find more on Publishers and Subscribers in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!