summaryrefslogtreecommitdiff
path: root/fix-humble-ros2-control-api.patch
diff options
context:
space:
mode:
Diffstat (limited to 'fix-humble-ros2-control-api.patch')
-rw-r--r--fix-humble-ros2-control-api.patch46
1 files changed, 46 insertions, 0 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'!",