diff --git a/.github/workflows/build_and_test.yaml b/.github/workflows/build_and_test.yaml index 03edeb0..aa4f39d 100644 --- a/.github/workflows/build_and_test.yaml +++ b/.github/workflows/build_and_test.yaml @@ -1,7 +1,7 @@ # This config uses industrial_ci (https://github.com/ros-industrial/industrial_ci.git). # For troubleshooting, see readme (https://github.com/ros-industrial/industrial_ci/blob/master/README.rst) -name: Build and Test (humble) +name: Build and Test # This determines when this workflow is run on: @@ -20,15 +20,13 @@ jobs: fail-fast: false matrix: env: - - CI_NAME: build-and-test - # TODO: Enable clang-tidy it's failing to errors unrelated to this repo - # - CI_NAME: clang-tidy - # CLANG_TIDY: true + - ROS_DISTRO: jazzy + - ROS_DISTRO: humble + - ROS_DISTRO: rolling env: CCACHE_DIR: /github/home/.ccache CXXFLAGS: "-Wall -Wextra -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls" - ROS_DISTRO: humble ROS_REPO: main runs-on: ubuntu-latest diff --git a/CMakeLists.txt b/CMakeLists.txt index 30f5487..a5584d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,6 +68,12 @@ if(BUILD_TESTING) target_link_libraries(topic_based_system_test ${PROJECT_NAME}) ament_target_dependencies(topic_based_system_test ${THIS_PACKAGE_INCLUDE_DEPENDS} ros2_control_test_assets) + target_compile_definitions( + topic_based_system_test + PRIVATE + HARDWARE_INTERFACE_VERSION_MAJOR=${hardware_interface_VERSION_MAJOR} + HARDWARE_INTERFACE_VERSION_MINOR=${hardware_interface_VERSION_MINOR} + HARDWARE_INTERFACE_VERSION_PATCH=${hardware_interface_VERSION_PATCH}) endif() pluginlib_export_plugin_description_file(hardware_interface topic_based_ros2_control_plugin_description.xml) diff --git a/test/topic_based_system_test.cpp b/test/topic_based_system_test.cpp index cbe9a0f..4db2607 100644 --- a/test/topic_based_system_test.cpp +++ b/test/topic_based_system_test.cpp @@ -33,10 +33,15 @@ #include #include +#include #include #include #include +#define VERSION_GREATER_EQUAL(major1, minor1, patch1, major2, minor2, patch2) \ + ((major1) > (major2) || \ + ((major1) == (major2) && ((minor1) > (minor2) || ((minor1) == (minor2) && (patch1) >= (patch2))))) + TEST(TestTopicBasedSystem, load_topic_based_system_2dof) { const std::string hardware_system_2dof_standard_interfaces_with_topic_based = @@ -63,7 +68,16 @@ TEST(TestTopicBasedSystem, load_topic_based_system_2dof) )"; auto urdf = ros2_control_test_assets::urdf_head + hardware_system_2dof_standard_interfaces_with_topic_based + ros2_control_test_assets::urdf_tail; + auto node = std::make_shared("test_topic_based_system"); + +// The API of the RessourceManager has changed in hardware_interface 4.13.0 +#if VERSION_GREATER_EQUAL(HARDWARE_INTERFACE_VERSION_MAJOR, HARDWARE_INTERFACE_VERSION_MINOR, \ + HARDWARE_INTERFACE_VERSION_PATCH, 4, 13, 0) + ASSERT_NO_THROW(hardware_interface::ResourceManager rm(urdf, node->get_node_clock_interface(), + node->get_node_logging_interface(), false)); +#else ASSERT_NO_THROW(hardware_interface::ResourceManager rm(urdf, true, false)); +#endif } int main(int argc, char** argv)