16#ifndef EASYFLEET_CORE__CAPABILITY_CLIENT_HPP_
17#define EASYFLEET_CORE__CAPABILITY_CLIENT_HPP_
24#include "rclcpp/rclcpp.hpp"
26#include "easyfleet_core/action_client.hpp"
28namespace easyfleet_core
54template<
typename ActionT>
59 using SharedPtr = std::shared_ptr<CapabilityClient<ActionT>>;
61 using Goal =
typename ActionT::Goal;
65 using Result =
typename ActionT::Result;
95 const std::string & capability_name,
96 std::chrono::milliseconds default_wait_timeout = std::chrono::seconds(5));
98 CapabilityClient(
const CapabilityClient &) =
delete;
99 CapabilityClient & operator=(
const CapabilityClient &) =
delete;
133 std::chrono::milliseconds timeout = std::chrono::milliseconds(0));
150#include "easyfleet_core/detail/capability_client_impl.hpp"
std::shared_ptr< ActionClient< ActionT > > SharedPtr
Shared pointer to an ActionClient<ActionT>.
Definition action_client.hpp:51
GoalOutcome
Outcome of a goal, unifying rejection/timeout/unavailability with the normal terminal states of the a...
Definition action_client.hpp:67
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
typename ActionT::Result Result
Result type of the wrapped action.
Definition capability_client.hpp:65
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
typename ActionT::Feedback Feedback
Feedback type of the wrapped action.
Definition capability_client.hpp:63
typename ActionClient< ActionT >::GoalOutcome Outcome
Same vocabulary as ActionClient::GoalOutcome.
Definition capability_client.hpp:70
Final outcome of a request, as delivered to a ResponseCallback or returned by request_and_wait().
Definition capability_client.hpp:75
Outcome outcome
How the request ended.
Definition capability_client.hpp:77
Result::SharedPtr result
Action-specific result, if outcome is Outcome::SUCCEEDED.
Definition capability_client.hpp:79