From c19f671e3fe9181fcb4dcdb9b487fdb6dc87a027 Mon Sep 17 00:00:00 2001 From: Christoph Froehlich Date: Thu, 2 Oct 2025 10:22:56 +0000 Subject: [PATCH] Fix deprecated hardware_interface API --- .../include/robotiq_driver/default_driver_factory.hpp | 4 ++-- .../include/robotiq_driver/default_serial_factory.hpp | 2 +- robotiq_driver/include/robotiq_driver/driver_factory.hpp | 2 +- robotiq_driver/include/robotiq_driver/hardware_interface.hpp | 2 +- robotiq_driver/include/robotiq_driver/serial_factory.hpp | 2 +- robotiq_driver/src/default_driver_factory.cpp | 4 ++-- robotiq_driver/src/default_serial_factory.cpp | 2 +- robotiq_driver/src/hardware_interface.cpp | 5 +++-- robotiq_driver/tests/test_default_driver_factory.cpp | 2 +- 9 files changed, 13 insertions(+), 12 deletions(-) diff --git a/robotiq_driver/include/robotiq_driver/default_driver_factory.hpp b/robotiq_driver/include/robotiq_driver/default_driver_factory.hpp index 142ce80..8c30658 100644 --- a/robotiq_driver/include/robotiq_driver/default_driver_factory.hpp +++ b/robotiq_driver/include/robotiq_driver/default_driver_factory.hpp @@ -50,10 +50,10 @@ class DefaultDriverFactory : public DriverFactory * @param info The hardware information. * @return A driver to interact with the hardware. */ - std::unique_ptr create(const hardware_interface::HardwareInfo& info) const; + std::unique_ptr create(const hardware_interface::HardwareComponentInterfaceParams& params) const; protected: // Seam for testing. - virtual std::unique_ptr create_driver(const hardware_interface::HardwareInfo& info) const; + virtual std::unique_ptr create_driver(const hardware_interface::HardwareComponentInterfaceParams& params) const; }; } // namespace robotiq_driver diff --git a/robotiq_driver/include/robotiq_driver/default_serial_factory.hpp b/robotiq_driver/include/robotiq_driver/default_serial_factory.hpp index e635674..627c6a6 100644 --- a/robotiq_driver/include/robotiq_driver/default_serial_factory.hpp +++ b/robotiq_driver/include/robotiq_driver/default_serial_factory.hpp @@ -49,7 +49,7 @@ class DefaultSerialFactory : public SerialFactory * @param info The hardware information. * @return A sarial interface to communicate with the hardware. */ - std::unique_ptr create(const hardware_interface::HardwareInfo& info) const; + std::unique_ptr create(const hardware_interface::HardwareComponentInterfaceParams& params) const; protected: // Seam for testing. diff --git a/robotiq_driver/include/robotiq_driver/driver_factory.hpp b/robotiq_driver/include/robotiq_driver/driver_factory.hpp index d06d96c..5743133 100644 --- a/robotiq_driver/include/robotiq_driver/driver_factory.hpp +++ b/robotiq_driver/include/robotiq_driver/driver_factory.hpp @@ -48,6 +48,6 @@ namespace robotiq_driver class DriverFactory { public: - virtual std::unique_ptr create(const hardware_interface::HardwareInfo& info) const = 0; + virtual std::unique_ptr create(const hardware_interface::HardwareComponentInterfaceParams& params) const = 0; }; } // namespace robotiq_driver diff --git a/robotiq_driver/include/robotiq_driver/hardware_interface.hpp b/robotiq_driver/include/robotiq_driver/hardware_interface.hpp index 517249a..9af6c57 100644 --- a/robotiq_driver/include/robotiq_driver/hardware_interface.hpp +++ b/robotiq_driver/include/robotiq_driver/hardware_interface.hpp @@ -77,7 +77,7 @@ class RobotiqGripperHardwareInterface : public hardware_interface::SystemInterfa * parsed or CallbackReturn::ERROR if any error happens or data are missing. */ ROBOTIQ_DRIVER_PUBLIC - CallbackReturn on_init(const hardware_interface::HardwareInfo& info) override; + CallbackReturn on_init(const hardware_interface::HardwareComponentInterfaceParams& params) override; /** * Connect to the hardware. diff --git a/robotiq_driver/include/robotiq_driver/serial_factory.hpp b/robotiq_driver/include/robotiq_driver/serial_factory.hpp index 8236215..9cc7044 100644 --- a/robotiq_driver/include/robotiq_driver/serial_factory.hpp +++ b/robotiq_driver/include/robotiq_driver/serial_factory.hpp @@ -49,7 +49,7 @@ namespace robotiq_driver class SerialFactory { public: - virtual std::unique_ptr create(const hardware_interface::HardwareInfo& info) const = 0; + virtual std::unique_ptr create(const hardware_interface::HardwareComponentInterfaceParams& params) const = 0; }; } // namespace robotiq_driver diff --git a/robotiq_driver/src/default_driver_factory.cpp b/robotiq_driver/src/default_driver_factory.cpp index 7d2f37a..d152245 100644 --- a/robotiq_driver/src/default_driver_factory.cpp +++ b/robotiq_driver/src/default_driver_factory.cpp @@ -53,7 +53,7 @@ constexpr double kGripperForceMultiplierParamDefault = 1.0; constexpr auto kUseDummyParamName = "use_dummy"; constexpr auto kUseDummyParamDefault = "false"; -std::unique_ptr DefaultDriverFactory::create(const hardware_interface::HardwareInfo& info) const +std::unique_ptr DefaultDriverFactory::create(const hardware_interface::HardwareComponentInterfaceParams& params) const { RCLCPP_INFO(kLogger, "Reading %s...", kSlaveAddressParamName); // Convert base-16 address stored as a string (for example, "0x9") into an integer @@ -83,7 +83,7 @@ std::unique_ptr DefaultDriverFactory::create(const hardware_interface::H return driver; } -std::unique_ptr DefaultDriverFactory::create_driver(const hardware_interface::HardwareInfo& info) const +std::unique_ptr DefaultDriverFactory::create_driver(const hardware_interface::HardwareComponentInterfaceParams& params) const { // We give the user an option to startup a dummy gripper for testing purposes. if (info.hardware_parameters.count(kUseDummyParamName) && diff --git a/robotiq_driver/src/default_serial_factory.cpp b/robotiq_driver/src/default_serial_factory.cpp index 598805e..c7f51d2 100644 --- a/robotiq_driver/src/default_serial_factory.cpp +++ b/robotiq_driver/src/default_serial_factory.cpp @@ -45,7 +45,7 @@ constexpr auto kBaudrateAddressParamDefault = 115200; constexpr auto kTimeoutParamName = "timeout"; constexpr auto kTimeoutParamDefault = 0.5; -std::unique_ptr DefaultSerialFactory::create(const hardware_interface::HardwareInfo& info) const +std::unique_ptr DefaultSerialFactory::create(const hardware_interface::HardwareComponentInterfaceParams& params) const { RCLCPP_INFO(kLogger, "Reading %s...", kUsbPortParamName); std::string usb_port = info.hardware_parameters.count(kUsbPortParamName) ? diff --git a/robotiq_driver/src/hardware_interface.cpp b/robotiq_driver/src/hardware_interface.cpp index b837af5..b22e789 100644 --- a/robotiq_driver/src/hardware_interface.cpp +++ b/robotiq_driver/src/hardware_interface.cpp @@ -72,11 +72,12 @@ RobotiqGripperHardwareInterface::RobotiqGripperHardwareInterface(std::unique_ptr { } -hardware_interface::CallbackReturn RobotiqGripperHardwareInterface::on_init(const hardware_interface::HardwareInfo& info) +hardware_interface::CallbackReturn RobotiqGripperHardwareInterface::on_init( + const hardware_interface::HardwareComponentInterfaceParams& params) { RCLCPP_DEBUG(kLogger, "on_init"); - if (hardware_interface::SystemInterface::on_init(info) != CallbackReturn::SUCCESS) + if (hardware_interface::SystemInterface::on_init(params) != CallbackReturn::SUCCESS) { return CallbackReturn::ERROR; } diff --git a/robotiq_driver/tests/test_default_driver_factory.cpp b/robotiq_driver/tests/test_default_driver_factory.cpp index b0a9913..945fa7b 100644 --- a/robotiq_driver/tests/test_default_driver_factory.cpp +++ b/robotiq_driver/tests/test_default_driver_factory.cpp @@ -45,7 +45,7 @@ class TestDriverFactory : public DefaultDriverFactory } protected: - std::unique_ptr create_driver([[maybe_unused]] const hardware_interface::HardwareInfo& info) const override + std::unique_ptr create_driver([[maybe_unused]] const hardware_interface::HardwareComponentInterfaceParams& params) const override { return std::move(driver_); }