Compiling ROS2 messages with comments fails when using special characters
조회 수: 2 (최근 30일)
이전 댓글 표시
I'm trying to compile custom ROS2 messages in Matlab using the ros2genmsg(path) command. I was getting errors in a certain custom message file which contains comments, and have narrowed down the issue to comments which contain a square bracket immediately after the hashtag.
For example:
This works -> float32 var_name_here #0[units in comment]
This causes an error when running ros2genmsg -> float32 var_name_here #[units in comment]
It seems that putting most any character (e.g. zero or a period) between the # and the square bracket makes things work. However, I haven't found anything in the ROS message formatting notes that shows this limitation on comments, and these custom message files seem to compile fine using ROS2 Foxy running on WSL2 (Ubuntu 20). Is this limitation in ROS2 comments that I'm unaware of, or is this something specific to Matlab? Are there any other workarounds or fixes for this problem that anyone knows about?
댓글 수: 2
Hari Krishna Kakarla
2022년 5월 18일
Hi Eric,
I have created a custom message with a field name "float32 var_name_here #[units in comment]" (same as what you mentioned above). I am able to successfully generate the custom messages without any error. I verified this workflow in the latest release R2022b. I am able to successfully generate custom messages for both the cases you mentioned.
Can you please let me know which release of MATLAB you are using?
Also, please copy the message field that you are facing this issue or may be the entire content of the msg file.
Yes, I agree with you that ROS message formatting notes doesn't have this kind of limitation anywhere. May be, this was a bug in our older release of MATLAB.
So, I suggest you to update to latest version of MATLAB (R2022b) if that works for you. Else, please add the comments of the field names at the top of it instead of next to the field names. Please see the example below.
Example:
#[units in comment]
float32 var_name_here
Thanks
Hari
답변 (1개)
Karthik Reddy Vennapureddy
2023년 4월 6일
Hi Eric,
Thank you for narrowing down the issue and sharing the message package with error logs. I am able to reproduce this issue on MATLAB R2021a and R2021b, as it uses ROS 2 Dashing Distribution. However, this issue is addressed in MATLAB R2022a with update in ROS 2 distribution from Dashing to Foxy.
So, I recommend you to update to latest version of MATLAB. Version >= R2022a should fix the issue.
Thanks,
Karthik Reddy
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Custom Message Support에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!