ROS2 Toolbox error when I try to add custom service/message

조회 수: 4 (최근 30일)
federico ciresola
federico ciresola 2024년 7월 12일
답변: Abhas 2024년 9월 3일
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
Jagadeesh Konakalla
Jagadeesh Konakalla 2024년 7월 12일
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
federico ciresola 2024년 7월 25일
Hi Jagadeesh,
sorry for my delay in answering your comment. I know that ros2RegisterMessages only works on the same OS platform and the same release of MATLAB.
My workflow that I was trying is as follows:
  1. from the Matlab Project in a X folder, I created the custom message with the following command: ros2genmsg(<path_custom_msg_srv>,CreateShareableFile=true);
  2. on the same machine, I copied the .zip (generated by the command above) into the Y folder
  3. I ran the following command: ros2RegisterMessages(<path where is the zip file>)
after this procedure, when I open Simulink and I click on the ROS2 block, the error (that I have reported in the main message) starts to appear. I have found that If I remove the `~/.matlab` folder, the problem disappears
OS version: Ubuntu 22.04
Matlab version: 23.2.0.2599560 (R2023b) Update 8

댓글을 달려면 로그인하십시오.

답변 (1개)

Abhas
Abhas 2024년 9월 3일
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:
  1. https://www.mathworks.com/help/releases/R2023b/ros/ref/ros2.html
  2. https://www.mathworks.com/help/releases/R2023b/ros/ug/ros2-custom-message-support.html

카테고리

Help CenterFile Exchange에서 Custom Message Support에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by