diff --git a/.github/workflows/ros-ci.yml b/.github/workflows/ros-ci.yml index 026afce..2b2f478 100644 --- a/.github/workflows/ros-ci.yml +++ b/.github/workflows/ros-ci.yml @@ -4,9 +4,9 @@ name: CI # Specifies the events that trigger the workflow on: push: - branches: [ humble, jazzy, main] + branches: [ jazzy, main ] pull_request: - branches: [ humble, jazzy, main] + branches: [ jazzy, main ] # Defines a set of jobs to be run as part of the workflow jobs: @@ -17,14 +17,14 @@ jobs: fail-fast: false matrix: ros_distribution: - - humble + # - humble - jazzy - rolling include: # ROS 2 Humble Hawksbill - - docker_image: ubuntu:jammy - ros_distribution: humble - ros_version: 2 + # - docker_image: ubuntu:jammy + # ros_distribution: humble + # ros_version: 2 # ROS 2 Jazzy Jalisco - docker_image: ubuntu:noble ros_distribution: jazzy diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c89a21c..992a90c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,11 @@ Changelog for package dynamixel_hardware_interface ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1.5.1 (2025-12-10) +------------------ +* Fixed deprecated interface for ros2 control +* Contributors: Woojin Wie + 1.5.0 (2025-11-26) ------------------ * Added comm_id/id concept for virtual_* devices. diff --git a/include/dynamixel_hardware_interface/dynamixel_hardware_interface.hpp b/include/dynamixel_hardware_interface/dynamixel_hardware_interface.hpp index a1b61da..6bb0c24 100644 --- a/include/dynamixel_hardware_interface/dynamixel_hardware_interface.hpp +++ b/include/dynamixel_hardware_interface/dynamixel_hardware_interface.hpp @@ -113,12 +113,12 @@ class DynamixelHardware : public /** * @brief Initialization callback for hardware interface. - * @param info Hardware information for the system. + * @param params Parameters for the hardware component interface. * @return Callback return indicating success or error. */ DYNAMIXEL_HARDWARE_INTERFACE_PUBLIC - hardware_interface::CallbackReturn on_init(const hardware_interface::HardwareInfo & info) - override; + hardware_interface::CallbackReturn on_init( + const hardware_interface::HardwareComponentInterfaceParams & params) override; /** * @brief Exports state interfaces for ROS2. @@ -315,6 +315,7 @@ class DynamixelHardware : public using StatePublisher = realtime_tools::RealtimePublisher; rclcpp::Publisher::SharedPtr dxl_state_pub_; std::unique_ptr dxl_state_pub_uni_ptr_; + DynamixelStateMsg dxl_state_msg_; rclcpp::Service::SharedPtr get_dxl_data_srv_; void get_dxl_data_srv_callback( diff --git a/package.xml b/package.xml index 06b9da5..53e8c67 100644 --- a/package.xml +++ b/package.xml @@ -2,7 +2,7 @@ dynamixel_hardware_interface - 1.5.0 + 1.5.1 ROS 2 package providing a hardware interface for controlling Dynamixel motors via the ROS 2 control framework. diff --git a/src/dynamixel_hardware_interface.cpp b/src/dynamixel_hardware_interface.cpp index 0b73025..3fefaf4 100644 --- a/src/dynamixel_hardware_interface.cpp +++ b/src/dynamixel_hardware_interface.cpp @@ -56,9 +56,9 @@ DynamixelHardware::~DynamixelHardware() } hardware_interface::CallbackReturn DynamixelHardware::on_init( - const hardware_interface::HardwareInfo & info) + const hardware_interface::HardwareComponentInterfaceParams & params) { - if (hardware_interface::SystemInterface::on_init(info) != + if (hardware_interface::SystemInterface::on_init(params) != hardware_interface::CallbackReturn::SUCCESS) { RCLCPP_ERROR_STREAM(logger_, "Failed to initialize DynamixelHardware"); @@ -359,11 +359,9 @@ hardware_interface::CallbackReturn DynamixelHardware::on_init( dxl_state_pub_uni_ptr_ = std::make_unique(dxl_state_pub_); size_t num_of_pub_data = hdl_trans_states_.size(); - dxl_state_pub_uni_ptr_->lock(); - dxl_state_pub_uni_ptr_->msg_.id.resize(num_of_pub_data); - dxl_state_pub_uni_ptr_->msg_.dxl_hw_state.resize(num_of_pub_data); - dxl_state_pub_uni_ptr_->msg_.torque_state.resize(num_of_pub_data); - dxl_state_pub_uni_ptr_->unlock(); + dxl_state_msg_.id.resize(num_of_pub_data); + dxl_state_msg_.dxl_hw_state.resize(num_of_pub_data); + dxl_state_msg_.torque_state.resize(num_of_pub_data); using namespace std::placeholders; @@ -647,18 +645,18 @@ hardware_interface::return_type DynamixelHardware::read( dxl_comm_->ReadItemBuf(); size_t index = 0; - if (dxl_state_pub_uni_ptr_ && dxl_state_pub_uni_ptr_->trylock()) { - dxl_state_pub_uni_ptr_->msg_.header.stamp = this->now(); - dxl_state_pub_uni_ptr_->msg_.comm_state = dxl_comm_err_; + if (dxl_state_pub_uni_ptr_) { + dxl_state_msg_.header.stamp = this->now(); + dxl_state_msg_.comm_state = dxl_comm_err_; for (auto it : hdl_trans_states_) { - dxl_state_pub_uni_ptr_->msg_.id.at(index) = it.id; - dxl_state_pub_uni_ptr_->msg_.dxl_hw_state.at(index) = dxl_hw_err_[it.id]; + dxl_state_msg_.id.at(index) = it.id; + dxl_state_msg_.dxl_hw_state.at(index) = dxl_hw_err_[it.id]; auto ts_it = dxl_torque_state_.find({it.comm_id, it.id}); bool ts = (ts_it != dxl_torque_state_.end()) ? ts_it->second : false; - dxl_state_pub_uni_ptr_->msg_.torque_state.at(index) = ts; + dxl_state_msg_.torque_state.at(index) = ts; index++; } - dxl_state_pub_uni_ptr_->unlockAndPublish(); + dxl_state_pub_uni_ptr_->try_publish(dxl_state_msg_); } if (rclcpp::ok()) {