eProsima/Integration-Service

'Could not find .mix file for message type' for messages not in std_msgs ROS1-SH

Closed this issue · 4 comments

I am able to run the ROS1 <> ROS2 example, but when modifying the example to work with a different type, e.g. sensor_msgs/LaserScan, everything compiles without error but when I run a different file:

systems:
  ros1: {type: ros1}
  ros2: {type: ros2}

routes:
  ros1_to_ros2: { from: ros1, to: ros2 }

topics:
  base_scan: { type: "sensor_msgs/LaserScan", route: ros1_to_ros2 }

I get the following error:

[Integration Service][ERROR] [is::sh::ROS1] Could not find .mix file for message type: 'sensor_msgs/LaserScan'
 -- Make sure that you have generated the 'is-ros1' extension for that message type by calling 'is_ros1_genmsg_mix(PACKAGES <package> MIDDLEWARES ros1)' in your build system!

I had added sensor_msgs as a dependency to ROS1-SH/utils/ros1-mix-generator/CMakeLists.txt b/utils/ros1-mix-generator/CMakeLists.txt:

find_package(sensor_msgs REQUIRED)
list(APPEND MIX_ROS_PACKAGES_LIST std_msgs sensor_msgs)

I then noticed the existence of the DMIX_ROS_PACKAGES flag which again compiled but then failed when running with the same error. I added this to both build commands from the documentation

colcon build --cmake-args -DMIX_ROS_PACKAGES="std_msgs sensor_msgs"

The .mix files seem to only be generated to the build folder:

find ./ -name "*.mix" | grep sensor_msgs/LaserScan
./build/is-ros2-mix-generator/is/rosidl/ros2/lib/is/ros2/msg/sensor_msgs/LaserScan.mix
./build/is-ros1-mix-generator/is/genmsg/ros1/lib/is/ros1/msg/sensor_msgs/LaserScan.mix
./install/is-ros2-mix-generator/lib/is/ros2/msg/sensor_msgs/LaserScan.mix

I'm using Noetic + Galactic

Good morning @Achllle,

I've tried it using the ROS 2 Galactic docker and installing ROS 1 Noetic, and it works correctly.

Try following these steps:

  1. Compile Integration Service:

        source /opt/ros/galactic/setup.bash
        colcon build --packages-skip-regex is-ros1 --cmake-args -DMIX_ROS_PACKAGES="sensor_msgs"
        source /opt/ros/noetic/setup.bash
        colcon build --cmake-args -DMIX_ROS_PACKAGES="sensor_msgs"
    

    Note: It is not necessary to modify the ros1-mix-generator CMakeLists.txt, it is already prepared to find the packages that you set with the MIX_ROS_PACKAGES flag.

  2. Execute the example. To enable communication from ROS 1 to ROS 2, open four terminals.

  • In the first terminal, source the ROS 1 installation and run the roscore:

       source /opt/ros/noetic/setup.bash
       roscore
    
  • In the second terminal, source the ROS 1 installation and launch the ROS 1 pub:

        source /opt/ros/noetic/setup.bash
        rostopic pub -r 1 /base_scan sensor_msgs/LaserScan "{ header: { seq: 0, stamp: {secs: 0, nsecs: 0}, frame_id: ''}, angle_min: 0.0, angle_max: 0.0, angle_increment: 0.0, time_increment: 0.0, scan_time: 0.0, range_min: 0.0, range_max: 0.0, ranges: [0], intensities: [0]}"
    
  • In the third terminal, source the ROS 2 installation and launch the ROS 2 echo:

        source /opt/ros/galactic/setup.bash
        ros2 topic echo /base_scan
    
  • In the fourth terminal, launch Integration Service with the modified YAML:

       source /opt/ros/galactic/setup.bash
       source /opt/ros/noetic/setup.bash
      source install/setup.bash
      integration-service src/Integration-Service/examples/basic/ros1_ros2__helloworld.yaml
    

Once Integration Service is launched, the ROS 1 pub and the ROS 2 echo will start communicating.

Thanks for your comment. Rebuilding the docker container solved it, it seems like when it failed to compile it prevented successful compilation later within the container because those are the exact commands that I ran.
It would be good to have that particular flag included in the generated documentation.

Good morning @Achllle,

That's good to hear.

Regarding the MIX_ROS_PACKAGES flag, it is documented within the compilation flags section of ROS 2 System Handle and within the compilation flags section of ROS 1 System Handle .

I am going to close this issue, please reopen it if you have any more problems and we will be happy to help.