From 110ecce45a48ca9ddf0634945917a24a82f95102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel=20Gonz=C3=A1lez=20Santamarta?= Date: Mon, 16 Dec 2024 21:46:28 +0100 Subject: [PATCH] removing unused params in demo servers --- yasmin_demos/src/add_two_ints_server.cpp | 10 ---------- yasmin_demos/src/fibonacci_action_server.cpp | 7 ++++--- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/yasmin_demos/src/add_two_ints_server.cpp b/yasmin_demos/src/add_two_ints_server.cpp index b4b78a0..3c83c60 100644 --- a/yasmin_demos/src/add_two_ints_server.cpp +++ b/yasmin_demos/src/add_two_ints_server.cpp @@ -65,16 +65,6 @@ class ServerNode final : public rclcpp::Node { * @brief Shared pointer to the "add_two_ints" service. */ rclcpp::Service::SharedPtr srv_; - - /** - * @brief Timer for one-shot mode to shut down the node after a request. - */ - rclcpp::TimerBase::SharedPtr timer_; - - /** - * @brief Flag indicating if a request has been received. - */ - bool saw_request_{false}; }; /** diff --git a/yasmin_demos/src/fibonacci_action_server.cpp b/yasmin_demos/src/fibonacci_action_server.cpp index e4fb635..c3544f6 100644 --- a/yasmin_demos/src/fibonacci_action_server.cpp +++ b/yasmin_demos/src/fibonacci_action_server.cpp @@ -44,9 +44,7 @@ class FibonacciActionServer : public rclcpp::Node { * callbacks. * @param options Node options for initialization. */ - explicit FibonacciActionServer( - const rclcpp::NodeOptions &options = rclcpp::NodeOptions()) - : Node("fibonacci_action_server", options) { + explicit FibonacciActionServer() : Node("fibonacci_action_server") { // Callback to handle goal requests. auto handle_goal = [this](const rclcpp_action::GoalUUID &uuid, @@ -115,6 +113,7 @@ class FibonacciActionServer : public rclcpp::Node { // Generate the Fibonacci sequence up to the requested order. for (int i = 1; (i < goal->order) && rclcpp::ok(); ++i) { + // Check if there is a cancel request. if (goal_handle->is_canceling()) { result->sequence = sequence; @@ -122,8 +121,10 @@ class FibonacciActionServer : public rclcpp::Node { RCLCPP_INFO(this->get_logger(), "Goal canceled"); return; } + // Update the sequence with the next number. sequence.push_back(sequence[i] + sequence[i - 1]); + // Publish feedback to the client. goal_handle->publish_feedback(feedback); RCLCPP_INFO(this->get_logger(), "Publish feedback");