Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow test_communication to use idl messages #549

Open
wants to merge 3 commits into
base: rolling
Choose a base branch
from

Conversation

MiguelCompany
Copy link

Opening this PR as requested on #542 (comment).

The CMake on test_communication package assumes that the messages in test_msgs package are defined as .msg files.

Since .msg files are converted into .idl files, and both are installed as resources in the ament index, we can always use the .idl ones, thus allowing messages to be defined directly in .idl files.

@@ -41,8 +41,8 @@ if(BUILD_TESTING)
foreach(interface_file ${interface_files})
get_filename_component(interface_ns "${interface_file}" DIRECTORY)
get_filename_component(interface_ns "${interface_ns}" NAME)
string_ends_with("${interface_file}" ".msg" is_message)
if(is_message AND interface_ns STREQUAL "msg")
string_ends_with("${interface_file}" ".idl" is_idl)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see current change works with test_communication pacakge, but more generally what we can do is,

  • if .idl, we can categorize them based on namespace.
  • and other files .msg, .srv and .action can be categorized with file extensions and namespace.

what do you think?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The official definition language is currently idl.
When .msg, .srv and .action files are processed, they are converted into .idl, and both files are installed and returned by ament_index_get_resource(interface_files "rosidl_interfaces" "<pkg_name>")

For instance, the contents of the file in install/share/ament_index/resource_index/rosidl_interfaces/test_msgs are the following:

action/Fibonacci.action
action/Fibonacci.idl
action/NestedMessage.action
action/NestedMessage.idl
msg/Arrays.idl
msg/Arrays.msg
msg/BasicTypes.idl
msg/BasicTypes.msg
msg/BoundedPlainSequences.idl
msg/BoundedPlainSequences.msg
msg/BoundedSequences.idl
msg/BoundedSequences.msg
msg/Builtins.idl
msg/Builtins.msg
msg/Constants.idl
msg/Constants.msg
msg/Defaults.idl
msg/Defaults.msg
msg/Empty.idl
msg/Empty.msg
msg/MultiNested.idl
msg/MultiNested.msg
msg/Nested.idl
msg/Nested.msg
msg/Strings.idl
msg/Strings.msg
msg/UnboundedSequences.idl
msg/UnboundedSequences.msg
msg/WStrings.idl
msg/WStrings.msg
srv/Arrays.idl
srv/Arrays.srv
srv/BasicTypes.idl
srv/BasicTypes.srv
srv/Empty.idl
srv/Empty.srv

So we should filter the list to remove duplicates. I think we should stick to .idl files.
We could take this a step further, and have a specific CMake function in either ament_index or rosidl_cmake to return the list of .idl in the ament index.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. In that case, to keep the consistent check for all endpoints, we also want to change the line 49 and 50 for service files to use is_idl and namespace check?

Copy link
Author

@MiguelCompany MiguelCompany Sep 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored to only process idl interfaces in 0eddfa9 and a8edc10

Copy link
Contributor

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@fujitatomoya
Copy link
Contributor

@methylDragon @clalancette can you review this?

@fujitatomoya
Copy link
Contributor

@clalancette can you assign this to yourself? (from waffle triage, but i do not have power...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants