Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions nav2_ros_common/include/nav2_ros_common/service_client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,16 @@ class ServiceClient
return service_name_;
}

/**
* @brief Stop any running spin operations on the internal executor
*/
void stop()
{
if (client_) {
callback_group_executor_->cancel();
}
}

protected:
std::string service_name_;
rclcpp::Clock::SharedPtr clock_;
Expand Down
6 changes: 6 additions & 0 deletions nav2_util/include/nav2_util/lifecycle_service_client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ class LifecycleServiceClient
}
}

~LifecycleServiceClient()
{
change_state_.stop();
get_state_.stop();
}

/// Trigger a state change
/**
* Throws std::runtime_error on failure
Expand Down
Loading