[ROS2] ros1_bridge not working for custom messages

asked 2020-07-24 01:14:31 -0600

blarghflargle gravatar image

updated 2020-08-03 13:09:15 -0600

Please help me figure out why my ros1_bridge can't bridge custom messages, I have been banging my head over this issue for three weeks.

I am trying to follow this guide on using ros1_bridge to bridge custom data types, https://github.com/ros2/ros1_bridge/b... , but when I run

ros2 run ros1_bridge dynamic_bridge --print-pairs

none of my custom messages show up, and when I try to use the ros1_bridge to bridge those messages over, they are not bridged over with no error message. On building the ros1_bridge I get an error message Failed to load Python extension for LZ4 support. LZ4 compression will not be available. but I doubt that is relevant.

I suspect the issue is that my ros1 package is not being found by cmake when ros1_bridge builds for some reason, due to these lines from the stdout.log file:

-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'roscpp'
--   Found roscpp, version 1.12.14
-- Checking for module 'std_msgs'
--   Found std_msgs, version 0.5.11
...

which do not check for module 'bridge_msgs' even though the CMAKE_PREFIX_PATH environment variable shows CMAKE_PREFIX_PATH= /home/nvidia/m2/ros2_msgs_ws/install/bridge_msgs: /home/nvidia/m2/ros2_msgs_ws/install/beginner_tutorials: /home/nvidia/m2/ros1_msgs_ws/devel: /home/nvidia/m2/ros_kinetic_build_ws/install_isolated

To build ros1_bridge, I (in terminal 1) run catkin_make in ros1_msgs_ws, (terminal 2) run colcon build in ros2_msgs_ws, and then in terminal 3 in the bridge_ws

source /home/nvidia/m2/ros_kinetic_build_ws/install_isolated/setup.bash
source /opt/ros/dashing/setup.bash
source ../ros1_msgs_ws/devel/local_setup.bash
source ../ros2_msgs_ws/install/local_setup.bash
colcon build --packages-select ros1_bridge --cmake-force-configure

Then close terminal 3, and open another terminal, source bridge_ws/install/setup.bash and ros2 run ros1_bridge dynamic_bridge --print-pairs, which does not print my custom messages

I am using ROS dashing (installed via apt-get) and ROS kinetic (built from source) on Ubuntu 18.04 on a NVidia Jetson Xavier (arm64 machine). I then downloaded the source code for the ros1_bridge-dashing package from github, and put it in its own workspace. My directory layout looks like this:

.
├─ ros1_msgs_ws
│  └─ src
│     └─ bridge_msgs
│        └─ msg
│           └─ JointCommand.msg
├─ ros2_msgs_ws
│  └─ src
│     └─ bridge_msgs
│        └─ msg
│           └─ JointCommand.msg
└─ bridge_ws
   └─ src
      └─ ros1_bridge
         └─ YAML file even though my custom interfaces have matching names

package.xml for ros1_msgs_ws

<?xml version="1.0"?>
<package format="2">
  <name>bridge_msgs</name>
  <version>0.0.0</version>
  <description>For Matthew Cui to learn to use ROS</description>

  <maintainer email="mcui6@ford.com">Matthew Cui</maintainer>
  <license>Apache 2.0</license>

  <build_depend>message_generation</build_depend>
  <exec_depend>message_runtime</exec_depend>
  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>rospy</build_depend>
  <build_depend>std_msgs</build_depend>
  <build_export_depend>roscpp</build_export_depend>
  <build_export_depend>rospy</build_export_depend>
  <build_export_depend>std_msgs</build_export_depend>
  <exec_depend>roscpp</exec_depend>
  <exec_depend>rospy</exec_depend>
  <exec_depend>std_msgs</exec_depend>

  <export>
  </export>
</package>

CMakeLists.txt for ros1_msgs_ws

cmake_minimum_required(VERSION 2.8.3)
project(bridge_msgs)
find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  std_msgs
  message_generation
)
add_message_files(
  FILES
  JointCommand.msg
)
generate_messages(
  DEPENDENCIES
  std_msgs
)
catkin_package(
  CATKIN_DEPENDS message_runtime roscpp rospy std_msgs
)
include_directories(
  include
  ${catkin_INCLUDE_DIRS}
)

package.xml for ros2_msgs_ws

<?xml version="1.0"?>
<package format="3">
  <name>bridge_msgs</name>
  <version>0.0.0</version>
  <description>For Matthew Cui to learn to migrate ROS1 packages ...
(more)
edit retag flag offensive close merge delete

Comments

Could you solve this problem? i am dealing with the same situation...

matyasg gravatar image matyasg  ( 2021-05-12 10:03:28 -0600 )edit