ros2 / ros1_bridge

ROS 2 package that provides bidirectional communication between ROS 1 and ROS 2
Apache License 2.0
425 stars 275 forks source link

RtabMap preventing ros1 bridge compilation #376

Closed Mechaick closed 1 year ago

Mechaick commented 1 year ago

Bug report

Required Info:

Steps to reproduce issue

Install ros noetic and ros foxy on the computer (Following the standard ROS tutorial)

Make a workspace for the bridge

source /opt/ros/noetic/setup.bash source /opt/ros/foxy/setup.bash colcon build --symlink-install --packages-select ros1_bridge --cmake-force-configure

At this point, the compilation is working

Then we need to install Rtabmap-ros binaries

sudo apt install ros-foxy-rtabmap-ros sudo apt install ros-noetic-rtabmap-ros

Then

source /opt/ros/noetic/setup.bash source /opt/ros/foxy/setup.bash colcon build --symlink-install --packages-select ros1_bridge

Expected behavior

The compilation should work, and after that adding a mapping rule should help bridging the rtabmap topics

Actual behavior

compilation is crashing with the following messages:

--- stderr: ros1_bridge                                        
/usr/bin/ld: warning: libconsole_bridge.so.0.4, needed by /opt/ros/noetic/lib/libcpp_common.so, may conflict with libconsole_bridge.so.1.0
/usr/bin/ld: libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_rtabmap_ros(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: libros1_bridge.so: undefined reference to `ros1_bridge::get_service_factory_rtabmap_ros(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/dynamic_bridge.dir/build.make:504: dynamic_bridge] Error 1
make[1]: *** [CMakeFiles/Makefile2:341: CMakeFiles/dynamic_bridge.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
/usr/bin/ld: libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_rtabmap_ros(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: libros1_bridge.so: undefined reference to `ros1_bridge::get_service_factory_rtabmap_ros(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/parameter_bridge.dir/build.make:504: parameter_bridge] Error 1
make[1]: *** [CMakeFiles/Makefile2:314: CMakeFiles/parameter_bridge.dir/all] Error 2
/usr/bin/ld: libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_rtabmap_ros(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: libros1_bridge.so: undefined reference to `ros1_bridge::get_service_factory_rtabmap_ros(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/static_bridge.dir/build.make:504: static_bridge] Error 1
make[1]: *** [CMakeFiles/Makefile2:233: CMakeFiles/static_bridge.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
---
Failed   <<< ros1_bridge [5min 6s, exited with code 2]

Summary: 0 packages finished [5min 6s]
  1 package failed: ros1_bridge
  1 package had stderr output: ros1_bridge
gbiggs commented 1 year ago

This is caused by the package name of rtabmap_ros in Foxy. In ROS 2, interface definitions (messages, services and actions) are, by convention, stored in their own package that has _interfaces (new) or _msgs as the suffix of its name. This is only a convention: in general things will work just fine if you don't do this. However the ros1_bridge has this convention hard-coded in when it searches for matching interface definitions between ROS 1 and ROS 2.

You need to file an issue with rtabmap_ros to ask them to move their interface definitions into a separate package that is named correctly. We can't fix your problem in the bridge.