As the title says, I am trying to find a list of field names that are reserved for defining new message interfaces, I searched every combination of keywords I could think of to no avail, does anyone know if such a list is maintained, and if so where it is found?
Background: I am in the process of migrating a large ROS 1 project to ROS 2, and have started by migrating all of my packages that specifically hold message definitions, for the most part this has been a smooth process of just copying over .msg, .srv, and .action files, however I ran into some issues building two of my custom messages. Here is one of the message definitions I am using:
std_msgs/Header header
float32 timestamp
uint32 timestamp_ros_secs
uint32 timestamp_ros_nsecs
string register
string data
When I try and build the workspace the build fails on that message, along with another which also contains all of those same-named fields. Here is an excerpt (since the rest seems to be repeating the same information) of the error printout:
In file included from /workspace/ros2_ws/build/llc_msgs/rosidl_generator_c/llc_msgs/msg/detail/capture_config__type_support.c:7:
/workspace/ros2_ws/build/llc_msgs/rosidl_generator_c/llc_msgs/msg/detail/capture_config__struct.h:36:28: error: expected identifier or ‘(’ before ‘register’
36 | rosidl_runtime_c__String register;
| ^~~~~~~~
In file included from /workspace/ros2_ws/build/llc_msgs/rosidl_generator_c/llc_msgs/msg/detail/capture_config__functions.h:28,
from /workspace/ros2_ws/build/llc_msgs/rosidl_generator_c/llc_msgs/msg/detail/capture_config__functions.c:4:
/workspace/ros2_ws/build/llc_msgs/rosidl_generator_c/llc_msgs/msg/detail/capture_config__struct.h:36:28: error: expected identifier or ‘(’ before ‘register’
36 | rosidl_runtime_c__String register;
| ^~~~~~~~
/workspace/ros2_ws/build/llc_msgs/rosidl_generator_c/llc_msgs/msg/detail/capture_config__functions.c: In function ‘llc_msgs__msg__CaptureConfig__init’:
/workspace/ros2_ws/build/llc_msgs/rosidl_generator_c/llc_msgs/msg/detail/capture_config__functions.c:36:45: error: expected identifier before ‘register’
36 | if (!rosidl_runtime_c__String__init(&msg->register)) {
| ^~~~~~~~
As I couldn't find anything relevant searching some of the terms in the error printout, I started looking at the message definitions themselves to try and figure out why these two in particular caused the build to fail, seeing the word "register" in the logs made me think I could be inadvertently using a reserved word for a field name. Long story short if I change the name "register" to something else, say "register1" or another variation, the build is successful. I believe this is enough evidence to be able to make the assumption that I was in fact using a reserved word, but after searching the ROS 2 documentation as best as I could I could not even find mention of requirements for field names beyond "must start with a lowercase alphanumeric", so I was wondering if anyone knew of where such a list may be?