I have the following issue - I get from a 3rd party a database which contains the message names and signals. I need to write a generator that creates ROS2 MSG files based on the input from the database and a header file that includes the HPP files generated by ROS2/IDL.
E.g. 1. For ThisMessage.msg Colcon/Ament will generate a this_message.hpp header.
But for OtherNASAMessage21.msg what will the name of the generated header be?
I'm using Humble on Linux
A somewhat similar question has been asked previously (Error when building custom ros2 msg, cannot find .hpp file) and the answer said to "check the naming conventions for the .hpp files".
Specifically can someone point out the link to said naming conventions or even the place in the build scripts/code in ROS2 where this name transformation is implemented?
Filename conversion is performed with the help of this cmake function:
#
# Convert a camel case string to lower case and underscores.
#
# :param str: the string
# :type str: string
# :param var: the output variable name
# :type var: bool
#
function(string_camel_case_to_lower_case_underscore str var)
# insert an underscore before any upper case letter
# which is not followed by another upper case letter
string(REGEX REPLACE "(.)([A-Z][a-z]+)" "\\1_\\2" value "${str}")
# insert an underscore before any upper case letter
# which is preseded by a lower case letter or number
string(REGEX REPLACE "([a-z0-9])([A-Z])" "\\1_\\2" value "${value}")
string(TOLOWER "${value}" value)
set(${var} "${value}" PARENT_SCOPE)
endfunction()