16#ifndef EASYFLEET_CORE__DETAIL__CAPABILITY_CLIENT_IMPL_HPP_
17#define EASYFLEET_CORE__DETAIL__CAPABILITY_CLIENT_IMPL_HPP_
29namespace easyfleet_core
32template<
typename ActionT>
35 const std::string & capability_name,
36 std::chrono::milliseconds default_wait_timeout)
43template<
typename ActionT>
45: action_client_(std::move(action_client))
49template<
typename ActionT>
52 return action_client_->wait_for_server();
55template<
typename ActionT>
58 return action_client_->wait_for_server(timeout);
61template<
typename ActionT>
67 action_client_->send_goal(
77template<
typename ActionT>
81 std::chrono::milliseconds timeout)
83 const auto result = action_client_->send_goal_and_wait(goal, on_feedback, timeout);
84 return Response{result.outcome, result.result};
87template<
typename ActionT>
90 action_client_->cancel_all_goals();
std::shared_ptr< ActionClient< ActionT > > SharedPtr
Shared pointer to an ActionClient<ActionT>.
Definition action_client.hpp:51
static SharedPtr create(rclcpp::Node &parent_node, const std::string &action_name, std::chrono::milliseconds default_server_timeout=std::chrono::seconds(5))
Constructs a new client for action_name, spinning its own internal node in the background.
Definition action_client_impl.hpp:36
void cancel()
Asks the capability to stop whatever it is currently doing (e.g.
Definition capability_client_impl.hpp:88
static SharedPtr create(rclcpp::Node &node, const std::string &capability_name, std::chrono::milliseconds default_wait_timeout=std::chrono::seconds(5))
Constructs a new client for the capability named capability_name.
Definition capability_client_impl.hpp:33
Response request_and_wait(const Goal &goal, FeedbackCallback on_feedback=nullptr, std::chrono::milliseconds timeout=std::chrono::milliseconds(0))
Asks the capability to do something and blocks the calling thread until the response is ready (or tim...
Definition capability_client_impl.hpp:78
std::shared_ptr< CapabilityClient< ActionT > > SharedPtr
Shared pointer to a CapabilityClient<ActionT>.
Definition capability_client.hpp:59
std::function< void(std::shared_ptr< const Feedback >)> FeedbackCallback
Callback invoked with feedback as it arrives for the request.
Definition capability_client.hpp:67
typename ActionT::Goal Goal
Goal type of the wrapped action.
Definition capability_client.hpp:61
bool wait_for_capability()
Blocks until the capability is reachable, using the constructor's default_wait_timeout.
Definition capability_client_impl.hpp:50
std::function< void(const Response &)> ResponseCallback
Callback invoked once a request reaches a final outcome.
Definition capability_client.hpp:83
void request(const Goal &goal, ResponseCallback on_response, FeedbackCallback on_feedback=nullptr)
Asks the capability to do something.
Definition capability_client_impl.hpp:62
Terminal outcome of a goal, as delivered to a ResultCallback or returned by send_goal_and_wait().
Definition action_client.hpp:79
GoalOutcome outcome
How the goal ended.
Definition action_client.hpp:81
Result::SharedPtr result
Action-specific result, if outcome is GoalOutcome::SUCCEEDED.
Definition action_client.hpp:85
Final outcome of a request, as delivered to a ResponseCallback or returned by request_and_wait().
Definition capability_client.hpp:75