Skip to content

Commit

Permalink
removing unused params in demo servers
Browse files Browse the repository at this point in the history
  • Loading branch information
mgonzs13 committed Dec 16, 2024
1 parent 06b4536 commit 110ecce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
10 changes: 0 additions & 10 deletions yasmin_demos/src/add_two_ints_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,6 @@ class ServerNode final : public rclcpp::Node {
* @brief Shared pointer to the "add_two_ints" service.
*/
rclcpp::Service<example_interfaces::srv::AddTwoInts>::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};
};

/**
Expand Down
7 changes: 4 additions & 3 deletions yasmin_demos/src/fibonacci_action_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -115,15 +113,18 @@ 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;
goal_handle->canceled(result);
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");
Expand Down

0 comments on commit 110ecce

Please sign in to comment.