From 52e6070af08162f6374c2f539eac8a088e862818 Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Tue, 26 Mar 2024 04:52:35 -0400 Subject: [PATCH 1/6] Replace random_shuffle with shuffle. (#1446) In C++14 and newer, std::random_shuffle is deprecated. Here, switch to using std::shuffle instead with a random number generator of our choosing. Signed-off-by: Chris Lalancette --- controller_manager/test/test_controller_manager_srvs.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/controller_manager/test/test_controller_manager_srvs.cpp b/controller_manager/test/test_controller_manager_srvs.cpp index f42c155e6d..24cd30bc06 100644 --- a/controller_manager/test/test_controller_manager_srvs.cpp +++ b/controller_manager/test/test_controller_manager_srvs.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -1503,7 +1504,9 @@ TEST_F(TestControllerManagerSrvs, list_sorted_large_chained_controller_tree) } // Now shuffle the list to be able to configure controller later randomly - std::random_shuffle(controllers_list.begin(), controllers_list.end()); + std::random_device rnd; + std::mt19937 mers(rnd()); + std::shuffle(controllers_list.begin(), controllers_list.end(), mers); { ControllerManagerRunner cm_runner(this); From b1288bdb76495233ec3b8b569f78afe61dd2443e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Fr=C3=B6hlich?= Date: Tue, 26 Mar 2024 09:53:31 +0100 Subject: [PATCH 2/6] Add cm as dependency to rqt_cm (#1447) --- rqt_controller_manager/package.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/rqt_controller_manager/package.xml b/rqt_controller_manager/package.xml index 0422af48bd..20c58c0efb 100644 --- a/rqt_controller_manager/package.xml +++ b/rqt_controller_manager/package.xml @@ -18,6 +18,7 @@ Kelsey Hawkins Adolfo Rodríguez Tsouroukdissian + controller_manager controller_manager_msgs rclpy rqt_gui From 5b5ec2005cfebce0ddb1f8799c666a0b8d30fa17 Mon Sep 17 00:00:00 2001 From: Sai Kishor Kothakota Date: Tue, 26 Mar 2024 09:54:15 +0100 Subject: [PATCH 3/6] Use ament_cmake generated rclcpp version header (#1448) --- controller_interface/CMakeLists.txt | 1 - .../include/controller_interface/controller_interface_base.hpp | 1 + controller_manager/CMakeLists.txt | 1 - controller_manager/src/controller_manager.cpp | 1 + 4 files changed, 2 insertions(+), 2 deletions(-) diff --git a/controller_interface/CMakeLists.txt b/controller_interface/CMakeLists.txt index da47eeb82f..917da0a8c9 100644 --- a/controller_interface/CMakeLists.txt +++ b/controller_interface/CMakeLists.txt @@ -15,7 +15,6 @@ find_package(ament_cmake REQUIRED) foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS}) find_package(${Dependency} REQUIRED) endforeach() -add_compile_definitions(RCLCPP_VERSION_MAJOR=${rclcpp_lifecycle_VERSION_MAJOR}) add_library(controller_interface SHARED src/controller_interface_base.cpp diff --git a/controller_interface/include/controller_interface/controller_interface_base.hpp b/controller_interface/include/controller_interface/controller_interface_base.hpp index 2de57d3f83..182ffa7fec 100644 --- a/controller_interface/include/controller_interface/controller_interface_base.hpp +++ b/controller_interface/include/controller_interface/controller_interface_base.hpp @@ -26,6 +26,7 @@ #include "hardware_interface/loaned_state_interface.hpp" #include "rclcpp/rclcpp.hpp" +#include "rclcpp/version.h" #include "rclcpp_lifecycle/lifecycle_node.hpp" namespace controller_interface diff --git a/controller_manager/CMakeLists.txt b/controller_manager/CMakeLists.txt index e8f1358147..1d6c76b5d5 100644 --- a/controller_manager/CMakeLists.txt +++ b/controller_manager/CMakeLists.txt @@ -25,7 +25,6 @@ find_package(backward_ros REQUIRED) foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS}) find_package(${Dependency} REQUIRED) endforeach() -add_compile_definitions(RCLCPP_VERSION_MAJOR=${rclcpp_VERSION_MAJOR}) add_library(controller_manager SHARED src/controller_manager.cpp diff --git a/controller_manager/src/controller_manager.cpp b/controller_manager/src/controller_manager.cpp index c85b9d3556..eadd1b0d78 100644 --- a/controller_manager/src/controller_manager.cpp +++ b/controller_manager/src/controller_manager.cpp @@ -25,6 +25,7 @@ #include "hardware_interface/types/lifecycle_state_names.hpp" #include "lifecycle_msgs/msg/state.hpp" #include "rclcpp/rclcpp.hpp" +#include "rclcpp/version.h" #include "rclcpp_lifecycle/state.hpp" namespace // utility From 8d3589eba465e6102bca3c5163e5e4001dc93a7a Mon Sep 17 00:00:00 2001 From: Sai Kishor Kothakota Date: Tue, 26 Mar 2024 09:55:23 +0100 Subject: [PATCH 4/6] generate version.h file per package using the ament_generate_version_header (#1449) --- controller_interface/CMakeLists.txt | 1 + controller_interface/package.xml | 1 + controller_manager/CMakeLists.txt | 1 + controller_manager/package.xml | 1 + hardware_interface/CMakeLists.txt | 1 + hardware_interface/package.xml | 1 + joint_limits/CMakeLists.txt | 1 + joint_limits/package.xml | 1 + transmission_interface/CMakeLists.txt | 1 + transmission_interface/package.xml | 1 + 10 files changed, 10 insertions(+) diff --git a/controller_interface/CMakeLists.txt b/controller_interface/CMakeLists.txt index 917da0a8c9..2b7ccb9203 100644 --- a/controller_interface/CMakeLists.txt +++ b/controller_interface/CMakeLists.txt @@ -89,3 +89,4 @@ install(TARGETS controller_interface ament_export_targets(export_controller_interface HAS_LIBRARY_TARGET) ament_export_dependencies(${THIS_PACKAGE_INCLUDE_DEPENDS}) ament_package() +ament_generate_version_header(${PROJECT_NAME}) diff --git a/controller_interface/package.xml b/controller_interface/package.xml index a76e63bb86..cf7e2ef084 100644 --- a/controller_interface/package.xml +++ b/controller_interface/package.xml @@ -9,6 +9,7 @@ Apache License 2.0 ament_cmake + ament_cmake_gen_version_h hardware_interface rclcpp_lifecycle diff --git a/controller_manager/CMakeLists.txt b/controller_manager/CMakeLists.txt index 1d6c76b5d5..e267856eb1 100644 --- a/controller_manager/CMakeLists.txt +++ b/controller_manager/CMakeLists.txt @@ -225,3 +225,4 @@ ament_python_install_package(controller_manager ament_export_targets(export_controller_manager HAS_LIBRARY_TARGET) ament_export_dependencies(${THIS_PACKAGE_INCLUDE_DEPENDS}) ament_package() +ament_generate_version_header(${PROJECT_NAME}) diff --git a/controller_manager/package.xml b/controller_manager/package.xml index d8920cea71..a6f0c0422b 100644 --- a/controller_manager/package.xml +++ b/controller_manager/package.xml @@ -9,6 +9,7 @@ Apache License 2.0 ament_cmake + ament_cmake_gen_version_h ament_cmake_python ament_index_cpp diff --git a/hardware_interface/CMakeLists.txt b/hardware_interface/CMakeLists.txt index 94eaa6a050..f6a4890cba 100644 --- a/hardware_interface/CMakeLists.txt +++ b/hardware_interface/CMakeLists.txt @@ -122,3 +122,4 @@ install( ament_export_targets(export_hardware_interface HAS_LIBRARY_TARGET) ament_export_dependencies(${THIS_PACKAGE_INCLUDE_DEPENDS}) ament_package() +ament_generate_version_header(${PROJECT_NAME}) diff --git a/hardware_interface/package.xml b/hardware_interface/package.xml index dc6fc642f7..194a7369da 100644 --- a/hardware_interface/package.xml +++ b/hardware_interface/package.xml @@ -8,6 +8,7 @@ Apache License 2.0 ament_cmake + ament_cmake_gen_version_h control_msgs lifecycle_msgs diff --git a/joint_limits/CMakeLists.txt b/joint_limits/CMakeLists.txt index f0ad3de6fc..1139a5248e 100644 --- a/joint_limits/CMakeLists.txt +++ b/joint_limits/CMakeLists.txt @@ -61,3 +61,4 @@ install(TARGETS joint_limits ament_export_targets(export_joint_limits HAS_LIBRARY_TARGET) ament_export_dependencies(${THIS_PACKAGE_INCLUDE_DEPENDS}) ament_package() +ament_generate_version_header(${PROJECT_NAME}) diff --git a/joint_limits/package.xml b/joint_limits/package.xml index 6028359b46..6b03f85d41 100644 --- a/joint_limits/package.xml +++ b/joint_limits/package.xml @@ -13,6 +13,7 @@ https://github.com/ros-controls/ros2_control ament_cmake + ament_cmake_gen_version_h rclcpp rclcpp_lifecycle diff --git a/transmission_interface/CMakeLists.txt b/transmission_interface/CMakeLists.txt index fc55c483d0..60d2075956 100644 --- a/transmission_interface/CMakeLists.txt +++ b/transmission_interface/CMakeLists.txt @@ -84,3 +84,4 @@ install(TARGETS transmission_interface ament_export_targets(export_transmission_interface HAS_LIBRARY_TARGET) ament_export_dependencies(${THIS_PACKAGE_INCLUDE_DEPENDS}) ament_package() +ament_generate_version_header(${PROJECT_NAME}) diff --git a/transmission_interface/package.xml b/transmission_interface/package.xml index 8d6875c23f..d77b82f5bd 100644 --- a/transmission_interface/package.xml +++ b/transmission_interface/package.xml @@ -9,6 +9,7 @@ Apache License 2.0 ament_cmake + ament_cmake_gen_version_h hardware_interface pluginlib From dcddb07fc1a060720c509369f9c4f36ced1a6c5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Fr=C3=B6hlich?= Date: Tue, 26 Mar 2024 09:56:27 +0100 Subject: [PATCH 5/6] Fix rqt_controller_manager for non-humble (#1454) --- .../rqt_controller_manager/controller_manager.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rqt_controller_manager/rqt_controller_manager/controller_manager.py b/rqt_controller_manager/rqt_controller_manager/controller_manager.py index 371eefd845..4a89b3cb97 100644 --- a/rqt_controller_manager/rqt_controller_manager/controller_manager.py +++ b/rqt_controller_manager/rqt_controller_manager/controller_manager.py @@ -415,10 +415,10 @@ def _get_parameter_controller_names(node, node_name): parameter_names = call_list_parameters(node=node, node_name=node_name) suffix = ".type" # @note: The versions conditioning is added here to support the source-compatibility with Humble - try: + if os.environ.get("ROS_DISTRO") == "humble": + # for humble, ros2param < 0.20.0 + return [n[: -len(suffix)] for n in parameter_names if n.endswith(suffix)] + else: return [ n[: -len(suffix)] for n in parameter_names.result().result.names if n.endswith(suffix) ] - finally: - # for humble, ros2param < 0.20.0 - return [n[: -len(suffix)] for n in parameter_names if n.endswith(suffix)] From 99d7128af013d16bb1ea536d52de7892154bb7db Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 26 Mar 2024 08:57:02 +0000 Subject: [PATCH 6/6] Bump version of pre-commit hooks (#1456) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 31ba833ba5..067da02ba4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -62,7 +62,7 @@ repos: # CPP hooks - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v18.1.1 + rev: v18.1.2 hooks: - id: clang-format args: ['-fallback-style=none', '-i']