ros2 / rosbag2_bag_v2

rosbag2 plugin for replaying ros1 version2 bag files
Apache License 2.0
24 stars 4 forks source link

theora image transport prevents building of ros1_bridge with opencv_calib3d not found #42

Closed berndpfrommer closed 2 years ago

berndpfrommer commented 3 years ago

I'm getting this error when trying to build the ROS bridge for custom messages. This is on Ubuntu 20.04, with ROS1 noetic and ROS2 foxy installed in parallel from the standard Ubuntu 20.04 packages:

. /opt/ros/noetic/setup.bash
. /opt/ros/foxy/local_setup.bash
. ~/Documents/my_ros1_overlay/devel/setup.bash    # to get ros1 custom message definition
. ~/Documents/my_ros2_overlay/install/local_setup.bash  # to get ros2 custom message definition

Then checkout the "foxy" branch of the ros1_bridge into separate workspace and build it:

colcon build --packages-select ros1_bridge --cmake-force-configure                                                     
Starting >>> ros1_bridge                                                                                                                                         
--- stderr: ros1_bridge                                                                                                                                          
CMake Error at /opt/ros/foxy/share/theora_image_transport/cmake/ament_cmake_export_dependencies-extras.cmake:21 (find_package):                                  
  By not providing "Findopencv_calib3d.cmake" in CMAKE_MODULE_PATH this                                                                                          
  project has asked CMake to find a package configuration file provided by                                                                                       
  "opencv_calib3d", but CMake did not find one.                                                                                                                  

  Could not find a package configuration file provided by "opencv_calib3d"                                                                                       
  with any of the following names:                                                                                                                               

    opencv_calib3dConfig.cmake                                                                                                                                   
    opencv_calib3d-config.cmake                                                                                                                                  

  Add the installation prefix of "opencv_calib3d" to CMAKE_PREFIX_PATH or set                                                               
  "opencv_calib3d_DIR" to a directory containing one of the above files.  If                                                                
  "opencv_calib3d" provides a separate development package or SDK, be sure it                                                               
  has been installed.                                                 
Call Stack (most recent call first):                                  
  /opt/ros/foxy/share/theora_image_transport/cmake/theora_image_transportConfig.cmake:41 (include)                                                                                                                                                                                      
  CMakeLists.txt:97 (find_package)                                    

The only way I can get it to build is by removing the theora image transport by inserting this on line 92 of ros1_bridge/CMakeLists.txt:

list(REMOVE_ITEM ros2_interface_packages "theora_image_transport")
emersonknapp commented 3 years ago

I don't know for sure, but something stood out about your sourcing:

. /opt/ros/noetic/setup.bash
. /opt/ros/foxy/local_setup.bash
. ~/Documents/my_ros1_overlay/devel/setup.bash    # to get ros1 custom message definition
. ~/Documents/my_ros2_overlay/install/local_setup.bash  # to get ros2 custom message definition

You should only need to source your individual workspace, if it was built against the /opt/ros installation, in both cases, e.g.

source my_ros1_overlay/devel/setup.bash
source my_ros2_overlay/install/setup.bash

It's probably fine, since you were using local_setup.bash (only sources the specific workspace) instead of setup.bash (sources workspace and its parent chaine.g. /opt/ros)

The usage for rosbag2_bag_v2 says you must source ROS 1 then ROS 2 - in your setup there you are mixing the order by sourcing 1,2,1,2. Can you try either the above 2-step source, or 1,1,2,2, and see if that works for you?

berndpfrommer commented 3 years ago

Thanks for the response! Traveling right now with no access to the robot for several more weeks. Will try different sourcing next time I get a chance.

berndpfrommer commented 2 years ago

I dropped the ball on this one. I upgraded to Galactic before trying your suggestion. As far as I am concerned this issue can be closed for now as I will not be able to reproduce it going forward.