Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Recursively Search for .msg files #77

Closed

Conversation

aditya2592
Copy link

We were trying to use mcap on a large ROS2 project and ran into an issue where .msg files were not being found in the install/<package_name>/share/<package_name>/msg/*.msg path. We got errors like below and the produced mcap files were empty.

[node-2] [WARN] [1668788082.046164202] [rosbag2_storage_mcap]: no .msg definition for AAA/BBB.msg, falling back to IDL

On closer look we saw that our package is structured to create .msg files in paths like install/<package_name>/share/<package_name>/<sub_directory_name>/*.msg. This is purely for organizational purposes and ROS2 doesn't have issue in finding these. So this PR modifies the MCAP plugin code to look for .msg files in any sub-directory within install/<package_name>/share/<package_name>/. It resolves our problem

@jtbandes
Copy link
Member

Can you look at the contents of /opt/ros/<distro>/share/ament_index/resource_index/rosidl_interfaces/<pkg_name> ? What does it look like?

I suspect that using the resource index for rosidl_interfaces is the more "correct" way of doing this.

@aditya2592
Copy link
Author

Looks like that file contains relative paths to msg and idl files. So would suggested solution be to read that file, form paths, match to desired .msg filename and check for existence?

@jtbandes
Copy link
Member

I think so. @emersonknapp do you know more about the ament index and would you be able to validate this proposal?

@jhurliman
Copy link
Contributor

We need to make this fix in foxglove_bridge as well. I created a ticket with a description of what I think is the correct way to use the ament_index_cpp library to resolve a datatype (package name plus type name) to an absolute path in the filesystem. foxglove/ros-foxglove-bridge#58

@james-rms
Copy link
Contributor

This codebase is moving over to ros2/rosbag2, so i've created an issue there capturing this. Lets move discussion around what to do to that issue.

@james-rms james-rms closed this Nov 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants