-
Notifications
You must be signed in to change notification settings - Fork 0
Description
deprecated warning hardware_interface::HardwareInfo
Files that may need to be changed
- https://github.com/ukaea/CRCOpenROS2Driver/blob/main/crcopen_hardware/src/crcopen_hardware.cpp
- https://github.com/ukaea/CRCOpenROS2Driver/blob/main/crcopen_hardware/include/crcopen_hardware.hpp
Branches that need to be addressed
- main
- jazzy
output we get from colcon build
/home/runner/work/CRCOpenROS2Driver/CRCOpenROS2Driver/crcopen_hardware/src/crcopen_hardware.cpp: In member function ‘virtual hardware_interface::CallbackReturn crcopen_hardware::CRCOpenHardware::on_init(const hardware_interface::HardwareInfo&)’: /home/runner/work/CRCOpenROS2Driver/CRCOpenROS2Driver/crcopen_hardware/src/crcopen_hardware.cpp:118:53: warning: ‘virtual rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn hardware_interface::HardwareComponentInterface::on_init(const hardware_interface::HardwareInfo&)’ is deprecated: Use on_init(const HardwareComponentInterfaceParams & params) instead. [-Wdeprecated-declarations] 118 | if (hardware_interface::SystemInterface::on_init(info) != hardware_interface::CallbackReturn::SUCCESS) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~ In file included from /opt/ros/rolling/include/hardware_interface/hardware_interface/system_interface.hpp:18, from /home/runner/work/CRCOpenROS2Driver/CRCOpenROS2Driver/crcopen_hardware/include/crcopen_hardware.hpp:20, from /home/runner/work/CRCOpenROS2Driver/CRCOpenROS2Driver/crcopen_hardware/src/crcopen_hardware.cpp:1: /opt/ros/rolling/include/hardware_interface/hardware_interface/hardware_component_interface.hpp:192:26: note: declared here 192 | virtual CallbackReturn on_init(const HardwareInfo & hardware_info)
resource to help understand issue:
https://control.ros.org/rolling/doc/api/classhardware__interface_1_1HardwareComponentInterface.html
My understanding of issue
We are seeing a deprecation warning from ros2_control Rolling because the on_init API for hardware components changed. The plugin still overrides/calls the old signature that takes a hardware_interface::HardwareInfo&. The framework now expects us to override the new signature that takes a hardware_interface::HardwareComponentInterfaceParams& and to call the base with that struct. The struct also carries the HardwareInfo (and an executor handle) inside it.
What the log means in plain English
- HardwareComponentInterface::on_init(const HardwareInfo&) is deprecated.
- We are calling SystemInterface::on_init(info) with HardwareInfo, so the compiler warns us.
- ros2_control wants us to implement and call on_init(const HardwareComponentInterfaceParams& params) instead. Inside, we can still access params.hardware_info (or info_ after calling the base) exactly like before