Structured metadata for message files

I want to open a discussion for adding metadata to message files.

I’m not sure if or how much of that already exists in the ROS2 world. But at least in ROS1 there’s no structure for comments, which for example makes it hard to generate good documentation from those files. Having other annotations can be useful as well, for example specifying a minimum value.

I have not gone into the details, but I imagine something like this:

# topic description
# @namespace xy

# field description
# @min min-value
# @ignored-value NaN
float x

float y # existing single-line field+comment is allowed as well

The tags are then parsed generically (no tag implies @comment tag), which then can be used in a code/idl/documentation template.
This should fit into the existing .msg file format structure.

@ivanpauno I’m seeing you did some work into that direction in Generate documentation in generated C header files based on ROS interfaces comments by ivanpauno · Pull Request #593 · ros2/rosidl · GitHub already
@TSC21 fyi

Just for reference, such kind of information (min/max/NaN etc) is sometimes defined in REPs such as “REP117 - Informational Distance Measurements”.

On a similar note, I really wish it were possible to deserialize a ROS message without the original message description, and the ability to add fields to a message in the future but still have old messages be forward-compatible with never version of the message; I haven’t really yet found a good solution other than sending protobufs as byte arrays or sending JSONs as a string inside a ROS message.