Failed to create custom ROS2 message
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am trying following tutorial: https://nl.mathworks.com/help/ros/ref/ros2genmsg.html
But I have an error with: ros2genmsg(folderPath)
Error using ros.ros2.internal.validateMsg (line 17)
Invalid message format, package, or structure found during validation.
Ensure that custom message packages follow structure and
naming rules.
Error in ros2genmsg (line 72)
ros.ros2.internal.validateMsg(folderPath);
If I test my custom message in a ROS2 environment it works fine so I assume that my CMakeLists.txt and package.xml are setup correctly.
How can I know if the setup of my message package is correct. Is there an example available to show what I need to add to my CMakeLists.txt and package.xml file so that Matlab can create my custom message.
Thanks!
2 comentarios
Alessandro Melino
el 27 de Nov. de 2019
Hello.
I got the same error trying to add this custom message:
#Name of file: CAN.msg
time timestamp
uint16 stdId
int32 extId
uint8[] data
It currently works on ROS as yours, so we have the same problem.
Did you find any solution?
Best regards.
Alessandro
Respuestas (1)
Cam Salzberger
el 5 de Dic. de 2019
ROS 2 has more strict rules about package, message, and field names than ROS did. Relevant here, fieldnames need to be all lowercase, except constants, message packages must be lowercase, message names must start with upper case, among other rules.
You also don't need to write your own package.xml and CMakeLists.txt files. MATLAB will generate those for you based on the message definitions.
If you check out the example here, it shows example custom message packages and the workflow. You can also look at the built-in message definitions for more extensive examples of message files.
-Cam
0 comentarios
Ver también
Categorías
Más información sobre Custom Message Support en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!