diff options
| -rw-r--r-- | fix-humble-ros2-control-api.patch | 46 | ||||
| -rw-r--r-- | picknik-reset-fault-controller.spec | 10 |
2 files changed, 55 insertions, 1 deletions
diff --git a/fix-humble-ros2-control-api.patch b/fix-humble-ros2-control-api.patch new file mode 100644 index 0000000..c1abded --- /dev/null +++ b/fix-humble-ros2-control-api.patch @@ -0,0 +1,46 @@ +--- a/picknik_reset_fault_controller/src/picknik_reset_fault_controller.cpp ++++ b/picknik_reset_fault_controller/src/picknik_reset_fault_controller.cpp +@@ -64,12 +64,8 @@ + { + if (realtime_publisher_) + { +- auto state_op = state_interfaces_[StateInterfaces::IN_FAULT].get_optional(); +- if (state_op.has_value()) +- { +- state_.data = static_cast<bool>(state_op.value()); +- } +- realtime_publisher_->try_publish(state_); ++ state_.data = static_cast<bool>(state_interfaces_[StateInterfaces::IN_FAULT].get_value()); ++ realtime_publisher_->tryPublish(state_); + } + + return controller_interface::return_type::OK; +@@ -124,23 +120,15 @@ + + RCLCPP_INFO(get_node()->get_logger(), "Trying to reset faults on hardware controller."); + +- while (command_interfaces_[CommandInterfaces::RESET_FAULT_ASYNC_SUCCESS].get_optional().value_or( +- ASYNC_WAITING) == ASYNC_WAITING) ++ while (command_interfaces_[CommandInterfaces::RESET_FAULT_ASYNC_SUCCESS].get_value() == ++ ASYNC_WAITING) + { + // Asynchronous wait until the hardware interface has set the io value + std::this_thread::sleep_for(std::chrono::milliseconds(50)); + } +- auto async_result_op = +- command_interfaces_[CommandInterfaces::RESET_FAULT_ASYNC_SUCCESS].get_optional(); +- if (!async_result_op.has_value()) +- { +- RCLCPP_ERROR( +- get_node()->get_logger(), +- "Failed to get result of fault reset command from hardware controller."); +- resp->success = false; +- return resp->success; +- } +- resp->success = static_cast<bool>(async_result_op.value()); ++ double async_result = ++ command_interfaces_[CommandInterfaces::RESET_FAULT_ASYNC_SUCCESS].get_value(); ++ resp->success = static_cast<bool>(async_result); + + RCLCPP_INFO( + get_node()->get_logger(), "Resetting fault on hardware controller '%s'!", diff --git a/picknik-reset-fault-controller.spec b/picknik-reset-fault-controller.spec index 814c37c..a935a60 100644 --- a/picknik-reset-fault-controller.spec +++ b/picknik-reset-fault-controller.spec @@ -5,11 +5,15 @@ Name: ros-%{ros_distro}-%{RosPkgName} Version: 0.0.5 -Release: 2%{?dist} +Release: 3%{?dist} Summary: ROS 2 controller that offers a service to clear faults in a hardware interface License: Apache-2.0 URL: https://github.com/PickNikRobotics/picknik_controllers Source0: https://github.com/PickNikRobotics/picknik_controllers/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz +# Adapt source to installed ros2_control 2.54.0 humble API: +# LoanedStateInterface/LoanedCommandInterface::get_value() (returns double, no get_optional) +# RealtimePublisher::tryPublish() (camelCase, no try_publish) +Patch0: fix-humble-ros2-control-api.patch # debug subpackage is meaningless for /opt prefix packages %global debug_package %{nil} @@ -82,6 +86,10 @@ make install DESTDIR=%{buildroot} /opt/ros/%{ros_distro} %changelog +* Fri Oct 09 2026 ROS SIG <ros-sig@openeuler.org> - 0.0.5-3 +- Add Patch0 to adapt source to installed ros2_control 2.54.0 humble API: + replace get_optional() with get_value() (returns double) and try_publish with tryPublish + * Fri Oct 09 2026 ROS SIG <ros-sig@openeuler.org> - 0.0.5-2 - Fix %build syntax error: escape %%cmake in comment to prevent RPM macro expansion |
