From 477ebb3e8d38c9cef72188e4c95ea83492a3e97b Mon Sep 17 00:00:00 2001 From: Christoph Froehlich Date: Sat, 3 Aug 2024 10:02:05 +0000 Subject: [PATCH 1/2] Add guards for correct version of ros2_control --- example_1/CMakeLists.txt | 8 ++++++++ example_10/CMakeLists.txt | 8 ++++++++ example_11/CMakeLists.txt | 8 ++++++++ example_12/CMakeLists.txt | 8 ++++++++ example_14/CMakeLists.txt | 8 ++++++++ example_2/CMakeLists.txt | 8 ++++++++ example_3/CMakeLists.txt | 8 ++++++++ example_4/CMakeLists.txt | 8 ++++++++ example_5/CMakeLists.txt | 8 ++++++++ example_6/CMakeLists.txt | 8 ++++++++ example_7/CMakeLists.txt | 8 ++++++++ example_8/CMakeLists.txt | 8 ++++++++ example_9/CMakeLists.txt | 8 ++++++++ 13 files changed, 104 insertions(+) diff --git a/example_1/CMakeLists.txt b/example_1/CMakeLists.txt index 2ec1702ed..c4a894de2 100644 --- a/example_1/CMakeLists.txt +++ b/example_1/CMakeLists.txt @@ -16,6 +16,14 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS rclcpp_lifecycle ) +# Specify the required version of ros2_control +find_package(ros2_control 4.0.0) +# Handle the case where the required version is not found +if(NOT ros2_control_FOUND) + message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " + "Are you using the correct branch of the ros2_control_demos repository?") +endif() + # find dependencies find_package(backward_ros REQUIRED) find_package(ament_cmake REQUIRED) diff --git a/example_10/CMakeLists.txt b/example_10/CMakeLists.txt index a9ee61abc..b83344e51 100644 --- a/example_10/CMakeLists.txt +++ b/example_10/CMakeLists.txt @@ -19,6 +19,14 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS controller_interface ) +# Specify the required version of ros2_control +find_package(ros2_control 4.0.0) +# Handle the case where the required version is not found +if(NOT ros2_control_FOUND) + message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " + "Are you using the correct branch of the ros2_control_demos repository?") +endif() + # find dependencies find_package(backward_ros REQUIRED) find_package(ament_cmake REQUIRED) diff --git a/example_11/CMakeLists.txt b/example_11/CMakeLists.txt index e6abfba4b..a0827f38d 100644 --- a/example_11/CMakeLists.txt +++ b/example_11/CMakeLists.txt @@ -16,6 +16,14 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS rclcpp_lifecycle ) +# Specify the required version of ros2_control +find_package(ros2_control 4.0.0) +# Handle the case where the required version is not found +if(NOT ros2_control_FOUND) + message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " + "Are you using the correct branch of the ros2_control_demos repository?") +endif() + # find dependencies find_package(backward_ros REQUIRED) find_package(ament_cmake REQUIRED) diff --git a/example_12/CMakeLists.txt b/example_12/CMakeLists.txt index ec887f4c3..99be4e6c0 100644 --- a/example_12/CMakeLists.txt +++ b/example_12/CMakeLists.txt @@ -22,6 +22,14 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS std_msgs ) +# Specify the required version of ros2_control +find_package(ros2_control 4.0.0) +# Handle the case where the required version is not found +if(NOT ros2_control_FOUND) + message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " + "Are you using the correct branch of the ros2_control_demos repository?") +endif() + # find dependencies find_package(backward_ros REQUIRED) find_package(ament_cmake REQUIRED) diff --git a/example_14/CMakeLists.txt b/example_14/CMakeLists.txt index 6287ceba6..fca306e85 100644 --- a/example_14/CMakeLists.txt +++ b/example_14/CMakeLists.txt @@ -17,6 +17,14 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS realtime_tools ) +# Specify the required version of ros2_control +find_package(ros2_control 4.0.0) +# Handle the case where the required version is not found +if(NOT ros2_control_FOUND) + message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " + "Are you using the correct branch of the ros2_control_demos repository?") +endif() + # find dependencies find_package(backward_ros REQUIRED) find_package(ament_cmake REQUIRED) diff --git a/example_2/CMakeLists.txt b/example_2/CMakeLists.txt index f419e6fde..077f689e0 100644 --- a/example_2/CMakeLists.txt +++ b/example_2/CMakeLists.txt @@ -16,6 +16,14 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS rclcpp_lifecycle ) +# Specify the required version of ros2_control +find_package(ros2_control 4.0.0) +# Handle the case where the required version is not found +if(NOT ros2_control_FOUND) + message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " + "Are you using the correct branch of the ros2_control_demos repository?") +endif() + # find dependencies find_package(backward_ros REQUIRED) find_package(ament_cmake REQUIRED) diff --git a/example_3/CMakeLists.txt b/example_3/CMakeLists.txt index 703c47f9d..297aa4cd5 100644 --- a/example_3/CMakeLists.txt +++ b/example_3/CMakeLists.txt @@ -16,6 +16,14 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS rclcpp_lifecycle ) +# Specify the required version of ros2_control +find_package(ros2_control 4.0.0) +# Handle the case where the required version is not found +if(NOT ros2_control_FOUND) + message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " + "Are you using the correct branch of the ros2_control_demos repository?") +endif() + # find dependencies find_package(backward_ros REQUIRED) find_package(ament_cmake REQUIRED) diff --git a/example_4/CMakeLists.txt b/example_4/CMakeLists.txt index 0666fc26d..a76128715 100644 --- a/example_4/CMakeLists.txt +++ b/example_4/CMakeLists.txt @@ -16,6 +16,14 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS rclcpp_lifecycle ) +# Specify the required version of ros2_control +find_package(ros2_control 4.0.0) +# Handle the case where the required version is not found +if(NOT ros2_control_FOUND) + message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " + "Are you using the correct branch of the ros2_control_demos repository?") +endif() + # find dependencies find_package(backward_ros REQUIRED) find_package(ament_cmake REQUIRED) diff --git a/example_5/CMakeLists.txt b/example_5/CMakeLists.txt index b5e2ed8cd..4cdfd8976 100644 --- a/example_5/CMakeLists.txt +++ b/example_5/CMakeLists.txt @@ -16,6 +16,14 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS rclcpp_lifecycle ) +# Specify the required version of ros2_control +find_package(ros2_control 4.0.0) +# Handle the case where the required version is not found +if(NOT ros2_control_FOUND) + message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " + "Are you using the correct branch of the ros2_control_demos repository?") +endif() + # find dependencies find_package(backward_ros REQUIRED) find_package(ament_cmake REQUIRED) diff --git a/example_6/CMakeLists.txt b/example_6/CMakeLists.txt index da5ce30e4..4b4b50c4f 100644 --- a/example_6/CMakeLists.txt +++ b/example_6/CMakeLists.txt @@ -16,6 +16,14 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS rclcpp_lifecycle ) +# Specify the required version of ros2_control +find_package(ros2_control 4.0.0) +# Handle the case where the required version is not found +if(NOT ros2_control_FOUND) + message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " + "Are you using the correct branch of the ros2_control_demos repository?") +endif() + # find dependencies find_package(backward_ros REQUIRED) find_package(ament_cmake REQUIRED) diff --git a/example_7/CMakeLists.txt b/example_7/CMakeLists.txt index 7ce5fd05e..9153ea26b 100644 --- a/example_7/CMakeLists.txt +++ b/example_7/CMakeLists.txt @@ -27,6 +27,14 @@ set(CONTROLLER_INCLUDE_DEPENDS trajectory_msgs ) +# Specify the required version of ros2_control +find_package(ros2_control 4.0.0) +# Handle the case where the required version is not found +if(NOT ros2_control_FOUND) + message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " + "Are you using the correct branch of the ros2_control_demos repository?") +endif() + # find dependencies find_package(backward_ros REQUIRED) find_package(ament_cmake REQUIRED) diff --git a/example_8/CMakeLists.txt b/example_8/CMakeLists.txt index 1edeb7888..b90ec4ce0 100644 --- a/example_8/CMakeLists.txt +++ b/example_8/CMakeLists.txt @@ -17,6 +17,14 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS transmission_interface ) +# Specify the required version of ros2_control +find_package(ros2_control 4.0.0) +# Handle the case where the required version is not found +if(NOT ros2_control_FOUND) + message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " + "Are you using the correct branch of the ros2_control_demos repository?") +endif() + # find dependencies find_package(backward_ros REQUIRED) find_package(ament_cmake REQUIRED) diff --git a/example_9/CMakeLists.txt b/example_9/CMakeLists.txt index 61f5b2478..de9273c88 100644 --- a/example_9/CMakeLists.txt +++ b/example_9/CMakeLists.txt @@ -16,6 +16,14 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS rclcpp_lifecycle ) +# Specify the required version of ros2_control +find_package(ros2_control 4.0.0) +# Handle the case where the required version is not found +if(NOT ros2_control_FOUND) + message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " + "Are you using the correct branch of the ros2_control_demos repository?") +endif() + # find dependencies find_package(backward_ros REQUIRED) find_package(ament_cmake REQUIRED) From a92ddcfae514dab44e1c4e5220a4dabd990c7404 Mon Sep 17 00:00:00 2001 From: Christoph Froehlich Date: Sat, 3 Aug 2024 10:26:44 +0000 Subject: [PATCH 2/2] Check for cm instead of ros2_control --- example_1/CMakeLists.txt | 4 ++-- example_10/CMakeLists.txt | 4 ++-- example_11/CMakeLists.txt | 4 ++-- example_12/CMakeLists.txt | 4 ++-- example_14/CMakeLists.txt | 4 ++-- example_2/CMakeLists.txt | 4 ++-- example_3/CMakeLists.txt | 4 ++-- example_4/CMakeLists.txt | 4 ++-- example_5/CMakeLists.txt | 4 ++-- example_6/CMakeLists.txt | 4 ++-- example_7/CMakeLists.txt | 4 ++-- example_8/CMakeLists.txt | 4 ++-- example_9/CMakeLists.txt | 4 ++-- 13 files changed, 26 insertions(+), 26 deletions(-) diff --git a/example_1/CMakeLists.txt b/example_1/CMakeLists.txt index c4a894de2..507f8f704 100644 --- a/example_1/CMakeLists.txt +++ b/example_1/CMakeLists.txt @@ -17,9 +17,9 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS ) # Specify the required version of ros2_control -find_package(ros2_control 4.0.0) +find_package(controller_manager 4.0.0) # Handle the case where the required version is not found -if(NOT ros2_control_FOUND) +if(NOT controller_manager_FOUND) message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " "Are you using the correct branch of the ros2_control_demos repository?") endif() diff --git a/example_10/CMakeLists.txt b/example_10/CMakeLists.txt index b83344e51..dee817871 100644 --- a/example_10/CMakeLists.txt +++ b/example_10/CMakeLists.txt @@ -20,9 +20,9 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS ) # Specify the required version of ros2_control -find_package(ros2_control 4.0.0) +find_package(controller_manager 4.0.0) # Handle the case where the required version is not found -if(NOT ros2_control_FOUND) +if(NOT controller_manager_FOUND) message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " "Are you using the correct branch of the ros2_control_demos repository?") endif() diff --git a/example_11/CMakeLists.txt b/example_11/CMakeLists.txt index a0827f38d..fd424e2d0 100644 --- a/example_11/CMakeLists.txt +++ b/example_11/CMakeLists.txt @@ -17,9 +17,9 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS ) # Specify the required version of ros2_control -find_package(ros2_control 4.0.0) +find_package(controller_manager 4.0.0) # Handle the case where the required version is not found -if(NOT ros2_control_FOUND) +if(NOT controller_manager_FOUND) message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " "Are you using the correct branch of the ros2_control_demos repository?") endif() diff --git a/example_12/CMakeLists.txt b/example_12/CMakeLists.txt index 99be4e6c0..793d5a29c 100644 --- a/example_12/CMakeLists.txt +++ b/example_12/CMakeLists.txt @@ -23,9 +23,9 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS ) # Specify the required version of ros2_control -find_package(ros2_control 4.0.0) +find_package(controller_manager 4.0.0) # Handle the case where the required version is not found -if(NOT ros2_control_FOUND) +if(NOT controller_manager_FOUND) message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " "Are you using the correct branch of the ros2_control_demos repository?") endif() diff --git a/example_14/CMakeLists.txt b/example_14/CMakeLists.txt index fca306e85..79d16afa4 100644 --- a/example_14/CMakeLists.txt +++ b/example_14/CMakeLists.txt @@ -18,9 +18,9 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS ) # Specify the required version of ros2_control -find_package(ros2_control 4.0.0) +find_package(controller_manager 4.0.0) # Handle the case where the required version is not found -if(NOT ros2_control_FOUND) +if(NOT controller_manager_FOUND) message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " "Are you using the correct branch of the ros2_control_demos repository?") endif() diff --git a/example_2/CMakeLists.txt b/example_2/CMakeLists.txt index 077f689e0..ad35ade9d 100644 --- a/example_2/CMakeLists.txt +++ b/example_2/CMakeLists.txt @@ -17,9 +17,9 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS ) # Specify the required version of ros2_control -find_package(ros2_control 4.0.0) +find_package(controller_manager 4.0.0) # Handle the case where the required version is not found -if(NOT ros2_control_FOUND) +if(NOT controller_manager_FOUND) message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " "Are you using the correct branch of the ros2_control_demos repository?") endif() diff --git a/example_3/CMakeLists.txt b/example_3/CMakeLists.txt index 297aa4cd5..bcae688de 100644 --- a/example_3/CMakeLists.txt +++ b/example_3/CMakeLists.txt @@ -17,9 +17,9 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS ) # Specify the required version of ros2_control -find_package(ros2_control 4.0.0) +find_package(controller_manager 4.0.0) # Handle the case where the required version is not found -if(NOT ros2_control_FOUND) +if(NOT controller_manager_FOUND) message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " "Are you using the correct branch of the ros2_control_demos repository?") endif() diff --git a/example_4/CMakeLists.txt b/example_4/CMakeLists.txt index a76128715..0b3b6c40a 100644 --- a/example_4/CMakeLists.txt +++ b/example_4/CMakeLists.txt @@ -17,9 +17,9 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS ) # Specify the required version of ros2_control -find_package(ros2_control 4.0.0) +find_package(controller_manager 4.0.0) # Handle the case where the required version is not found -if(NOT ros2_control_FOUND) +if(NOT controller_manager_FOUND) message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " "Are you using the correct branch of the ros2_control_demos repository?") endif() diff --git a/example_5/CMakeLists.txt b/example_5/CMakeLists.txt index 4cdfd8976..14424074f 100644 --- a/example_5/CMakeLists.txt +++ b/example_5/CMakeLists.txt @@ -17,9 +17,9 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS ) # Specify the required version of ros2_control -find_package(ros2_control 4.0.0) +find_package(controller_manager 4.0.0) # Handle the case where the required version is not found -if(NOT ros2_control_FOUND) +if(NOT controller_manager_FOUND) message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " "Are you using the correct branch of the ros2_control_demos repository?") endif() diff --git a/example_6/CMakeLists.txt b/example_6/CMakeLists.txt index 4b4b50c4f..127e33953 100644 --- a/example_6/CMakeLists.txt +++ b/example_6/CMakeLists.txt @@ -17,9 +17,9 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS ) # Specify the required version of ros2_control -find_package(ros2_control 4.0.0) +find_package(controller_manager 4.0.0) # Handle the case where the required version is not found -if(NOT ros2_control_FOUND) +if(NOT controller_manager_FOUND) message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " "Are you using the correct branch of the ros2_control_demos repository?") endif() diff --git a/example_7/CMakeLists.txt b/example_7/CMakeLists.txt index 9153ea26b..3813a4203 100644 --- a/example_7/CMakeLists.txt +++ b/example_7/CMakeLists.txt @@ -28,9 +28,9 @@ set(CONTROLLER_INCLUDE_DEPENDS ) # Specify the required version of ros2_control -find_package(ros2_control 4.0.0) +find_package(controller_manager 4.0.0) # Handle the case where the required version is not found -if(NOT ros2_control_FOUND) +if(NOT controller_manager_FOUND) message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " "Are you using the correct branch of the ros2_control_demos repository?") endif() diff --git a/example_8/CMakeLists.txt b/example_8/CMakeLists.txt index b90ec4ce0..5866833c5 100644 --- a/example_8/CMakeLists.txt +++ b/example_8/CMakeLists.txt @@ -18,9 +18,9 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS ) # Specify the required version of ros2_control -find_package(ros2_control 4.0.0) +find_package(controller_manager 4.0.0) # Handle the case where the required version is not found -if(NOT ros2_control_FOUND) +if(NOT controller_manager_FOUND) message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " "Are you using the correct branch of the ros2_control_demos repository?") endif() diff --git a/example_9/CMakeLists.txt b/example_9/CMakeLists.txt index de9273c88..957a10131 100644 --- a/example_9/CMakeLists.txt +++ b/example_9/CMakeLists.txt @@ -17,9 +17,9 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS ) # Specify the required version of ros2_control -find_package(ros2_control 4.0.0) +find_package(controller_manager 4.0.0) # Handle the case where the required version is not found -if(NOT ros2_control_FOUND) +if(NOT controller_manager_FOUND) message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " "Are you using the correct branch of the ros2_control_demos repository?") endif()