|
nros C++ API
Lightweight ROS 2 client for embedded real-time systems (C++ headers)
|
#include <action_client.hpp>
Classes | |
| struct | GoalAccept |
| struct | SendGoalOptions |
Public Types | |
| using | FeedbackType = typename A::Feedback |
| using | GoalType = typename A::Goal |
| using | ResultType = typename A::Result |
Public Member Functions | |
| ActionClient () | |
| ActionClient (ActionClient &&other) | |
| Stream< FeedbackType > & | feedback_stream () |
| const Stream< FeedbackType > & | feedback_stream () const |
| Result | get_result (const uint8_t goal_id[16], ResultType &result) |
| Result | get_result_async (const uint8_t goal_id[16]) |
| Future< ResultType > | get_result_future (const uint8_t goal_id[16]) |
| bool | is_valid () const |
| Check if the action client is initialized and valid. | |
| ActionClient & | operator= (ActionClient &&other) |
| void | poll () |
| Result | send_goal (const GoalType &goal, uint8_t goal_id[16]) |
| Result | send_goal_async (const GoalType &goal, uint8_t goal_id[16]) |
| Future< GoalAccept > | send_goal_future (const GoalType &goal) |
| Result | set_callbacks (const SendGoalOptions &options) |
| Result | try_recv_feedback (FeedbackType &feedback) |
| ~ActionClient () | |
| Destructor — releases action client resources. | |
Friends | |
| class | Node |
Typed action client for a ROS 2 action.
Mirrors rclcpp_action::Client<A>. The action type A must provide nested Goal, Result, and Feedback types with TYPE_NAME, TYPE_HASH, SERIALIZED_SIZE_MAX, ffi_serialize(), and ffi_deserialize().
Usage:
|
inline |
Destructor — releases action client resources.
|
inline |
|
inline |
Default constructor — creates an uninitialized action client. Use Node::create_action_client() to initialize.
|
inline |
Get a reference to the action client's feedback stream.
The stream yields FeedbackType values across all currently-active goals for this client — feedback is not goal-scoped at this layer. Callers that need per-goal separation should use the callback API (set_callbacks(SendGoalOptions{ .feedback = … })), which delivers (goal_id, bytes, len, ctx) via an executor-driven trampoline.
Usage (blocking):
Usage (non-blocking):
|
inline |
|
inline |
Get the result for a goal (blocking with timeout).
Sends a get_result request and spins the executor until a reply arrives or timeout (Phase 82 compliant – drives the executor).
| goal_id | 16-byte goal UUID from send_goal(). |
| result | Output result struct (filled on success). |
|
inline |
Request the result for a goal asynchronously (non-blocking).
Returns immediately after sending the get_result request. The result arrives via the result callback during poll().
| goal_id | 16-byte goal UUID from send_goal_async(). |
|
inline |
Request a goal result and return a Future for the result.
Sends the get_result request asynchronously and returns a Future that resolves when the result arrives. Poll the future (or call wait()) to retrieve the deserialized result.
Usage:
| goal_id | 16-byte goal UUID from send_goal() or GoalAccept. |
|
inline |
Check if the action client is initialized and valid.
|
inline |
|
inline |
Poll for pending async replies (non-blocking).
Checks for goal acceptance, feedback, and result replies. Invokes the corresponding callbacks registered via set_callbacks(). Call this in the spin loop after spin_once().
Send a goal and receive the generated goal UUID (blocking).
Internally spins the executor until the server accepts or rejects the goal (Phase 82 compliant – drives the executor).
| goal | Goal to send. |
| goal_id | Output 16-byte goal UUID (filled on success). |
|
inline |
Send a goal asynchronously (non-blocking).
Returns immediately after sending the goal request. The goal UUID is filled on success. Responses arrive via callbacks registered with the executor (see SendGoalOptions and Node::create_action_client).
| goal | Goal to send. |
| goal_id | Output 16-byte goal UUID (filled on success). |
|
inline |
Send a goal and return a Future for the acceptance response.
Returns immediately after sending the goal request. Poll the returned future (or call wait()) to get the GoalAccept result.
Usage:
| goal | Goal to send. |
|
inline |
Register async callbacks for goal response, feedback, and result.
| options | Callback pointers and context. |
|
inline |
Try to receive feedback (non-blocking).
| feedback | Output feedback struct (filled on success). |