簡體   English   中英

無法在 Bazel Workspace 中使用帶有 drake-ros 的底層 ros2 安裝作為外部

[英]Unable to use underlay ros2 installation with drake-ros as an external in a Bazel Workspace

在 ros-humble 安裝之后使用ros2_local_repositorydebian 方式)會產生以下 CMAKE 錯誤 -

--- captured stderr ---
CMake Warning at /opt/ros/humble/share/quality_of_service_demo_cpp/cmake/ament_cmake_export_include_directories-extras.cmake:11 (message):
  Package 'quality_of_service_demo_cpp' exports the include directory
  '/opt/ros/humble/share/quality_of_service_demo_cpp/cmake/../../../include/quality_of_service_demo_cpp'
  which doesn't exist
Call Stack (most recent call first):
  /opt/ros/humble/share/quality_of_service_demo_cpp/cmake/quality_of_service_demo_cppConfig.cmake:41 (include)
  CMakeLists.txt:16 (find_package)


CMake Error at CMakeLists.txt:19 (add_library):
  Target "empty_using_image_tools" links to target
  "sensor_msgs::sensor_msgs__rosidl_generator_c" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:19 (add_library):
  Target "empty_using_image_tools" links to target
  "sensor_msgs::sensor_msgs__rosidl_typesupport_fastrtps_c" but the target
  was not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?


CMake Error at CMakeLists.txt:19 (add_library):
  Target "empty_using_image_tools" links to target
  "sensor_msgs::sensor_msgs__rosidl_generator_cpp" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:19 (add_library):
  Target "empty_using_image_tools" links to target
  "sensor_msgs::sensor_msgs__rosidl_typesupport_fastrtps_cpp" but the target
  was not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?


CMake Error at CMakeLists.txt:19 (add_library):
  Target "empty_using_image_tools" links to target
  "sensor_msgs::sensor_msgs__rosidl_typesupport_introspection_c" but the
  target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?


CMake Error at CMakeLists.txt:19 (add_library):
  Target "empty_using_image_tools" links to target
  "sensor_msgs::sensor_msgs__rosidl_typesupport_c" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:19 (add_library):
  Target "empty_using_image_tools" links to target
  "sensor_msgs::sensor_msgs__rosidl_typesupport_introspection_cpp" but the
  target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?


CMake Error at CMakeLists.txt:19 (add_library):
  Target "empty_using_image_tools" links to target
  "sensor_msgs::sensor_msgs__rosidl_typesupport_cpp" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:19 (add_library):
  Target "empty_using_image_tools" links to target
  "sensor_msgs::sensor_msgs__rosidl_generator_py" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:19 (add_library):
  Target "empty_using_image_tools" links to target
  "sensor_msgs::sensor_msgs_library" but the target was not found.  Perhaps a
  find_package() call is missing for an IMPORTED target, or an ALIAS target
  is missing?


CMake Generate step failed.  Build files cannot be regenerated correctly.
CMake Error at CMakeLists.txt:19 (add_library):
  Target "empty_using_tf2_bullet" links to target "tf2::tf2" but the target
  was not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?


CMake Error at CMakeLists.txt:19 (add_library):
  Target "empty_using_tf2_bullet" links to target
  "geometry_msgs::geometry_msgs__rosidl_generator_c" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:19 (add_library):
  Target "empty_using_tf2_bullet" links to target
  "geometry_msgs::geometry_msgs__rosidl_typesupport_fastrtps_c" but the
  target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?


CMake Error at CMakeLists.txt:19 (add_library):
  Target "empty_using_tf2_bullet" links to target
  "geometry_msgs::geometry_msgs__rosidl_typesupport_introspection_c" but the
  target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?


CMake Error at CMakeLists.txt:19 (add_library):
  Target "empty_using_tf2_bullet" links to target
  "geometry_msgs::geometry_msgs__rosidl_typesupport_c" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:19 (add_library):
  Target "empty_using_tf2_bullet" links to target
  "geometry_msgs::geometry_msgs__rosidl_generator_cpp" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:19 (add_library):
  Target "empty_using_tf2_bullet" links to target
  "geometry_msgs::geometry_msgs__rosidl_typesupport_fastrtps_cpp" but the
  target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?


CMake Error at CMakeLists.txt:19 (add_library):
  Target "empty_using_tf2_bullet" links to target
  "geometry_msgs::geometry_msgs__rosidl_typesupport_introspection_cpp" but
  the target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?


CMake Error at CMakeLists.txt:19 (add_library):
  Target "empty_using_tf2_bullet" links to target
  "geometry_msgs::geometry_msgs__rosidl_typesupport_cpp" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?


CMake Error at CMakeLists.txt:19 (add_library):
  Target "empty_using_tf2_bullet" links to target
  "geometry_msgs::geometry_msgs__rosidl_generator_py" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:19 (add_library):
  Target "empty_using_tf2_bullet" links to target "tf2_ros::tf2_ros" but the
  target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?


CMake Generate step failed.  Build files cannot be regenerated correctly.

嘗試使用 drake-ros 的 bazel 規則構建我的[outdoor_slam_ros2][1] package。

來自WORKSPACE的相關片段。 有沒有其他方法可以通過覆蓋工作區提取包並使用?

# Use ROS 2
ros2_local_repository(
    name = "ros2",
    workspaces = ["/opt/ros/humble/"],
    )

安裝ros-humble-desktop后,我可以重現相同的錯誤。 解決方案是使用include_packages選項將您需要的包從工作區包含到ros2_local_repository()

ros2_local_repository(
    name = "ros2",
    include_packages = [
      "rclcpp",
    ],
    workspaces = ["/opt/ros/humble/"],
)

在后台ros2_local_repository()使用 CMake 文件 API 來“抓取”關於 ROS 2 包的信息,為@ros2構建一個BUILD.bazel文件。 該“抓取”通過為 ROS 2 工作區中的每個 package 生成一個 CMake package 來工作。 生成的 package 試圖依賴於 ROS 2 package 中它負責抓取的所有內容。 這可以發現 ROS 2 package 的 CMake 邏輯中的錯誤,這些錯誤在典型使用中可能看不到。

以這個為例:

CMake Error at CMakeLists.txt:19 (add_library):
  Target "empty_using_tf2_bullet" links to target "tf2_ros::tf2_ros" but the
  target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?

錯誤在於tf2_bullet 公開依賴於tf2_ros::tf2_ros ,但不告訴下游包find_package(tf2_ros)以訪問該目標。 tf2_bullet包的CMakeLists.txt缺少行ament_export_dependencies(tf2_ros)這將使下游包在find_package(tf2_ros) find_package(tf2_bullet) 這個錯誤的存在可能意味着沒有多少開發人員在使用tf2_bullet ,或者他們也已經直接或間接調用find_package(tf2_ros)

使用include_packages選項通過指示ros2_local_repository()僅抓取實際需要的 ROS 2 包而不是抓取工作區中的所有包來避免此類錯誤。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM