Compiling ROS2 messages with comments fails when using special characters
3 次查看(过去 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 中查找有关 Specialized Messages 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!