Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RessourceManager constructor #30

Merged
merged 5 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 14 additions & 0 deletions test/topic_based_system_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,15 @@

#include <gtest/gtest.h>
#include <hardware_interface/resource_manager.hpp>
#include <rclcpp/node.hpp>
#include <rclcpp/utilities.hpp>
#include <rclcpp_lifecycle/state.hpp>
#include <ros2_control_test_assets/descriptions.hpp>

#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 =
Expand All @@ -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<rclcpp::Node>("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)
Expand Down
Loading