From a78310f9b04ca6508927088f1d506a03db433f85 Mon Sep 17 00:00:00 2001 From: Taehun Lim Date: Sun, 16 Oct 2022 00:28:05 +0900 Subject: [PATCH 1/6] foros: deleted override options of publisher functions Signed-off-by: Taehun Lim --- foros/include/akit/failover/foros/cluster_node_publisher.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/foros/include/akit/failover/foros/cluster_node_publisher.hpp b/foros/include/akit/failover/foros/cluster_node_publisher.hpp index 2a9a7e5..fd0aee6 100644 --- a/foros/include/akit/failover/foros/cluster_node_publisher.hpp +++ b/foros/include/akit/failover/foros/cluster_node_publisher.hpp @@ -72,7 +72,7 @@ class ClusterNodePublisher : public rclcpp::Publisher { * * \param[in] msg a message to publish. */ - void publish(std::unique_ptr msg) override { + void publish(std::unique_ptr msg) { if (node_lifecycle_interface_ != nullptr && !node_lifecycle_interface_->is_activated()) { // ignore publish request when publisher is not activated @@ -88,7 +88,7 @@ class ClusterNodePublisher : public rclcpp::Publisher { * * \param[in] msg a message to publish. */ - void publish(const MessageT& msg) override { + void publish(const MessageT& msg) { if (node_lifecycle_interface_ != nullptr && !node_lifecycle_interface_->is_activated()) { // ignore publish request when publisher is not activated From 99f059ca0295a5d105015aaa2b24b280c7151e8d Mon Sep 17 00:00:00 2001 From: Taehun Lim Date: Sun, 16 Oct 2022 00:33:51 +0900 Subject: [PATCH 2/6] foros: added log to deprecated ros2 api Signed-off-by: Taehun Lim --- foros/include/akit/failover/foros/cluster_node.hpp | 2 ++ foros/src/cluster_node.cpp | 5 ----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/foros/include/akit/failover/foros/cluster_node.hpp b/foros/include/akit/failover/foros/cluster_node.hpp index 4dd8f5e..c2a7720 100644 --- a/foros/include/akit/failover/foros/cluster_node.hpp +++ b/foros/include/akit/failover/foros/cluster_node.hpp @@ -138,7 +138,9 @@ class ClusterNode : public std::enable_shared_from_this, /// Return the list of callback groups in the node. /** * \return List of callback groups in the node. + * \deprecated */ + [[deprecated("get_callback_groups(): Not included in humble")]] CLUSTER_NODE_PUBLIC const std::vector &get_callback_groups() const; diff --git a/foros/src/cluster_node.cpp b/foros/src/cluster_node.cpp index f2dbe9f..af0cf74 100644 --- a/foros/src/cluster_node.cpp +++ b/foros/src/cluster_node.cpp @@ -119,11 +119,6 @@ rclcpp::CallbackGroup::SharedPtr ClusterNode::create_callback_group( group_type, automatically_add_to_executor_with_node); } -const std::vector - &ClusterNode::get_callback_groups() const { - return node_base_->get_callback_groups(); -} - const rclcpp::ParameterValue &ClusterNode::declare_parameter( const std::string &name, const rclcpp::ParameterValue &default_value, const rcl_interfaces::msg::ParameterDescriptor ¶meter_descriptor, From 74dcc3d116ff9d6cb000c25c526951e62f8fbcfa Mon Sep 17 00:00:00 2001 From: Taehun Lim Date: Sun, 16 Oct 2022 00:34:18 +0900 Subject: [PATCH 3/6] foros: modified return type Signed-off-by: Taehun Lim --- foros/test/test_raft.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foros/test/test_raft.hpp b/foros/test/test_raft.hpp index d4c4a88..0c9540d 100644 --- a/foros/test/test_raft.hpp +++ b/foros/test/test_raft.hpp @@ -112,7 +112,7 @@ class TestContext : public akit::failover::foros::raft::Context { request->prev_log_index = prev_log_index; request->prev_log_term = prev_log_term; request->entries = entries; - return append_entries_->async_send_request(request); + return append_entries_->async_send_request(request).future.share(); } private: From 864d429c0bb0dad0ff33408b267edd93cd7a8928 Mon Sep 17 00:00:00 2001 From: Taehun Lim Date: Mon, 17 Oct 2022 02:21:09 +0900 Subject: [PATCH 4/6] foros: deleted a method Signed-off-by: Taehun Lim --- foros/include/akit/failover/foros/cluster_node.hpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/foros/include/akit/failover/foros/cluster_node.hpp b/foros/include/akit/failover/foros/cluster_node.hpp index c2a7720..b13c086 100644 --- a/foros/include/akit/failover/foros/cluster_node.hpp +++ b/foros/include/akit/failover/foros/cluster_node.hpp @@ -135,16 +135,6 @@ class ClusterNode : public std::enable_shared_from_this, rclcpp::CallbackGroupType group_type, bool automatically_add_to_executor_with_node = true); - /// Return the list of callback groups in the node. - /** - * \return List of callback groups in the node. - * \deprecated - */ - [[deprecated("get_callback_groups(): Not included in humble")]] - CLUSTER_NODE_PUBLIC - const std::vector &get_callback_groups() - const; - /// Create a Publisher. /** * The rclcpp::QoS has several convenient constructors, including a From cf2a8c1746068bc53906aecc9b53db9251a2947d Mon Sep 17 00:00:00 2001 From: Taehun Lim Date: Mon, 17 Oct 2022 02:24:21 +0900 Subject: [PATCH 5/6] foros: added new method Signed-off-by: Taehun Lim --- foros/include/akit/failover/foros/cluster_node.hpp | 11 +++++++++++ foros/src/cluster_node.cpp | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/foros/include/akit/failover/foros/cluster_node.hpp b/foros/include/akit/failover/foros/cluster_node.hpp index b13c086..2838634 100644 --- a/foros/include/akit/failover/foros/cluster_node.hpp +++ b/foros/include/akit/failover/foros/cluster_node.hpp @@ -135,6 +135,17 @@ class ClusterNode : public std::enable_shared_from_this, rclcpp::CallbackGroupType group_type, bool automatically_add_to_executor_with_node = true); + /// Iterate over the callback groups in the node, calling func on each valid one. + /** + * From Humble, get_callback_groups() is replaced with this method. + * https://github.com/ros2/rclcpp/pull/1723 + * + * \param[in] func The callback function to call on each valid callback group. + */ + CLUSTER_NODE_PUBLIC + void for_each_callback_group( + const rclcpp::node_interfaces::NodeBaseInterface::CallbackGroupFunction & func); + /// Create a Publisher. /** * The rclcpp::QoS has several convenient constructors, including a diff --git a/foros/src/cluster_node.cpp b/foros/src/cluster_node.cpp index af0cf74..a9dc831 100644 --- a/foros/src/cluster_node.cpp +++ b/foros/src/cluster_node.cpp @@ -119,6 +119,11 @@ rclcpp::CallbackGroup::SharedPtr ClusterNode::create_callback_group( group_type, automatically_add_to_executor_with_node); } +void ClusterNode::for_each_callback_group( + const rclcpp::node_interfaces::NodeBaseInterface::CallbackGroupFunction & func) { + node_base_->for_each_callback_group(func); +} + const rclcpp::ParameterValue &ClusterNode::declare_parameter( const std::string &name, const rclcpp::ParameterValue &default_value, const rcl_interfaces::msg::ParameterDescriptor ¶meter_descriptor, From 43a786cf1bdb9833410d6c0d43b9afc2f29cea8e Mon Sep 17 00:00:00 2001 From: Taehun Lim Date: Mon, 17 Oct 2022 23:31:02 +0900 Subject: [PATCH 6/6] ci: applied clang format Signed-off-by: Taehun Lim --- foros/include/akit/failover/foros/cluster_node.hpp | 6 ++++-- foros/src/cluster_node.cpp | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/foros/include/akit/failover/foros/cluster_node.hpp b/foros/include/akit/failover/foros/cluster_node.hpp index 2838634..0fbc6ee 100644 --- a/foros/include/akit/failover/foros/cluster_node.hpp +++ b/foros/include/akit/failover/foros/cluster_node.hpp @@ -135,7 +135,8 @@ class ClusterNode : public std::enable_shared_from_this, rclcpp::CallbackGroupType group_type, bool automatically_add_to_executor_with_node = true); - /// Iterate over the callback groups in the node, calling func on each valid one. + /// Iterate over the callback groups in the node, calling func on each valid + /// one. /** * From Humble, get_callback_groups() is replaced with this method. * https://github.com/ros2/rclcpp/pull/1723 @@ -144,7 +145,8 @@ class ClusterNode : public std::enable_shared_from_this, */ CLUSTER_NODE_PUBLIC void for_each_callback_group( - const rclcpp::node_interfaces::NodeBaseInterface::CallbackGroupFunction & func); + const rclcpp::node_interfaces::NodeBaseInterface::CallbackGroupFunction + &func); /// Create a Publisher. /** diff --git a/foros/src/cluster_node.cpp b/foros/src/cluster_node.cpp index a9dc831..ce4ba8d 100644 --- a/foros/src/cluster_node.cpp +++ b/foros/src/cluster_node.cpp @@ -120,7 +120,8 @@ rclcpp::CallbackGroup::SharedPtr ClusterNode::create_callback_group( } void ClusterNode::for_each_callback_group( - const rclcpp::node_interfaces::NodeBaseInterface::CallbackGroupFunction & func) { + const rclcpp::node_interfaces::NodeBaseInterface::CallbackGroupFunction + &func) { node_base_->for_each_callback_group(func); }