Skip to content
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
20 changes: 14 additions & 6 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

name: Build and Test

permissions:
contents: read

# This determines when this workflow is run
on:
workflow_dispatch:
Expand All @@ -16,27 +19,32 @@ on:

jobs:
industrial_ci:
name: industrial_ci (${{ matrix.env.ROS_DISTRO }})
strategy:
fail-fast: false
matrix:
env:
- ROS_DISTRO: jazzy
- ROS_DISTRO: humble
ROS_REPO: main
- ROS_DISTRO: jazzy
ROS_REPO: main
- ROS_DISTRO: lyrical
ROS_REPO: main
- ROS_DISTRO: rolling
ROS_REPO: testing

env:
CCACHE_DIR: /github/home/.ccache
CXXFLAGS: "-Wall -Wextra -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls"
ROS_REPO: main

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
# This step will fetch/store the directory used by ccache before/after the ci run
- uses: actions/cache@v4
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-{{ matrix.env.ROS_DISTRO }}-{{ matrix.env.ROS_REPO }}
key: ccache-${{ matrix.env.ROS_DISTRO }}-${{ matrix.env.ROS_REPO }}
# Run industrial_ci
- uses: 'ros-industrial/industrial_ci@master'
- uses: ros-industrial/industrial_ci@125164b9f1883cdf1858897a7146d1bebf2be5c6 # master
env: ${{ matrix.env }}
12 changes: 9 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ add_library(
${PROJECT_NAME}
src/topic_based_system.cpp
)
ament_target_dependencies(${PROJECT_NAME} ${THIS_PACKAGE_INCLUDE_DEPENDS})
target_link_libraries(${PROJECT_NAME} PUBLIC
angles::angles
hardware_interface::hardware_interface
rclcpp::rclcpp
${sensor_msgs_TARGETS}
)
target_include_directories(${PROJECT_NAME}
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
Expand Down Expand Up @@ -69,8 +74,9 @@ if(BUILD_TESTING)
# GTests
ament_add_gtest(topic_based_system_test test/topic_based_system_test.cpp)
target_link_libraries(topic_based_system_test
${PROJECT_NAME})
ament_target_dependencies(topic_based_system_test ${THIS_PACKAGE_INCLUDE_DEPENDS} ros2_control_test_assets)
${PROJECT_NAME}
ros2_control_test_assets::ros2_control_test_assets
)

# Integration tests
add_ros_test(
Expand Down
9 changes: 9 additions & 0 deletions include/topic_based_ros2_control/topic_based_system.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
#include <hardware_interface/handle.hpp>
#include <hardware_interface/hardware_info.hpp>
#include <hardware_interface/system_interface.hpp>
#if __has_include(<hardware_interface/hardware_interface/version.h>)
#include <hardware_interface/hardware_interface/version.h>
#else
#include <hardware_interface/version.h>
#endif
#include <hardware_interface/types/hardware_interface_return_values.hpp>
#include <hardware_interface/types/hardware_interface_type_values.hpp>
#include <rclcpp/node.hpp>
Expand All @@ -55,7 +60,11 @@ using CallbackReturn = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface
class TopicBasedSystem : public hardware_interface::SystemInterface
{
public:
#if HARDWARE_INTERFACE_VERSION_GTE(6, 0, 0)
CallbackReturn on_init(const hardware_interface::HardwareComponentInterfaceParams& params) override;
#else
CallbackReturn on_init(const hardware_interface::HardwareInfo& info) override;
#endif

std::vector<hardware_interface::StateInterface> export_state_interfaces() override;

Expand Down
6 changes: 6 additions & 0 deletions src/topic_based_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,15 @@ static constexpr std::size_t VELOCITY_INTERFACE_INDEX = 1;
// JointState doesn't contain an acceleration field, so right now it's not used
static constexpr std::size_t EFFORT_INTERFACE_INDEX = 3;

#if HARDWARE_INTERFACE_VERSION_GTE(6, 0, 0)
CallbackReturn TopicBasedSystem::on_init(const hardware_interface::HardwareComponentInterfaceParams& params)
{
if (hardware_interface::SystemInterface::on_init(params) != CallbackReturn::SUCCESS)
#else
CallbackReturn TopicBasedSystem::on_init(const hardware_interface::HardwareInfo& info)
{
if (hardware_interface::SystemInterface::on_init(info) != CallbackReturn::SUCCESS)
#endif
{
return CallbackReturn::ERROR;
}
Expand Down
Loading