|
| ::rclcpp::Result | abort (const ::rclcpp_action::GoalUUID &goal_id, const ResultType &result) |
| | abort taking a GoalUUID value.
|
| ::rclcpp::Result | abort (const uint8_t goal_id[16], const ResultType &result) |
| ::rclcpp::Result | canceled (const ::rclcpp_action::GoalUUID &goal_id, const ResultType &result) |
| | canceled taking a GoalUUID value.
|
| ::rclcpp::Result | canceled (const uint8_t goal_id[16], const ResultType &result) |
| ::rclcpp::Result | complete_goal (const ::rclcpp_action::GoalUUID &goal_id, ::rclcpp_action::GoalStatus status, const ResultType &result) |
| | complete_goal taking a GoalUUID value (phase-417 W4.b).
|
| ::rclcpp::Result | complete_goal (const ::rclcpp_action::GoalUUID &goal_id, const ResultType &result) |
| | complete_goal taking a GoalUUID value (phase-417 W4.b).
|
| ::rclcpp::Result | complete_goal (const uint8_t goal_id[16], ::rclcpp_action::GoalStatus status, const ResultType &result) |
| ::rclcpp::Result | complete_goal (const uint8_t goal_id[16], const ResultType &result) |
| ::rclcpp::Result | execute (const ::rclcpp_action::GoalUUID &goal_id) |
| | execute taking a GoalUUID value.
|
| ::rclcpp::Result | execute (const uint8_t goal_id[16]) |
| template<typename F> |
| ::rclcpp::Result | for_each_active_goal (F f) |
| const char * | get_action_name () const |
| bool | goal_exists (const ::rclcpp_action::GoalUUID &goal_id) const |
| | goal_exists taking a GoalUUID value.
|
| bool | goal_exists (const uint8_t goal_id[16]) const |
| bool | is_valid () const |
| | Check if the action server is initialized and valid.
|
| Server & | operator= (Server &&other) |
| ::rclcpp::Result | publish_feedback (const ::rclcpp_action::GoalUUID &goal_id, const FeedbackType &feedback) |
| | publish_feedback taking a GoalUUID value (phase-417 W4.b).
|
| ::rclcpp::Result | publish_feedback (const uint8_t goal_id[16], const FeedbackType &feedback) |
| | Server () |
| | Server (Server &&other) |
| template<typename F> |
| ::rclcpp::Result | set_accepted_callback (F f) |
| ::rclcpp::Result | set_accepted_callback_with_ctx (TypedAcceptedFnWithCtx f, void *ctx) |
| template<typename F> |
| ::rclcpp::Result | set_cancel_callback (F f) |
| ::rclcpp::Result | set_cancel_callback_with_ctx (TypedCancelFnWithCtx f, void *ctx) |
| template<typename F> |
| ::rclcpp::Result | set_goal_callback (F f) |
| ::rclcpp::Result | set_goal_callback_with_ctx (TypedGoalFnWithCtx f, void *ctx) |
| ::rclcpp::Result | succeed (const ::rclcpp_action::GoalUUID &goal_id, const ResultType &result) |
| | succeed taking a GoalUUID value.
|
| ::rclcpp::Result | succeed (const uint8_t goal_id[16], const ResultType &result) |
| | ~Server () |
template<typename A>
class rclcpp_action::Server< A >
Typed action server for a ROS 2 action.
Mirrors upstream's rclcpp_action::Server<A> with a callback-based API. 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:
using Fib = example_interfaces::action::Fibonacci;
RCLCPP_TRY(node.create_action_server(srv,
"/fibonacci"));
[](const uint8_t[16], const Fib::Goal& g) {
});
Definition server.hpp:351
::rclcpp::Result set_goal_callback(F f)
Definition server.hpp:389
@ REJECT
Definition server.hpp:207
@ ACCEPT_AND_EXECUTE
Definition server.hpp:208
#define RCLCPP_TRY(expr)
Definition result.hpp:259
Callbacks must be stateless (empty-capture lambdas or plain function pointers). This is a freestanding C++14 library without std::function, so per-instance closure storage is not available.
What upstream's Server<A> has and this one does not (ADOPT-BOUNDED):
- Not a Waitable: no execute / is_ready / set_on_ready_callback / clear_on_ready_callback. RFC-0002's executor drives the server directly through the RMW vtable; there is no wait set to join.
- Each missing member is a compile error (no member named ...).
Issue 2015 — on a HOSTED build (NROS_CPP_STD) upstream's construction is a drop-in: rclcpp_action::create_server<A>(node interfaces..., name,
handle_goal, handle_cancel, handle_accepted) returns a SharedPtr (rclcpp::Owned<Server>, the server by value) and the callbacks take upstream's shapes — std::shared_ptr<const Goal> and a std::shared_ptr<ServerGoalHandle<A>> whose publish_feedback / succeed / abort / canceled / is_canceling forward to THIS server, keyed by the goal id. The goals still live in the server's static arena; the handle is a heap token over the id. A freestanding build keeps the goal-id-keyed form below and refuses the handle shapes.
Start EXECUTING the accepted goal goal_id — issue 2027.
Moves the goal from ACCEPTED to EXECUTING and publishes the status array: upstream's goal_handle->execute(), keyed by goal id, and C's rclc_action_execute. A goal the goal callback answered GoalResponse::ACCEPT_AND_DEFER starts this way, from the accepted callback or later. NotFound for a goal this server no longer holds, NotAllowed for one that is not ACCEPTED (already executing, canceling, or terminal), where upstream raises; nothing is changed or published then.
The goal-id API leaves a goal ACCEPTED after ACCEPT_AND_EXECUTE (the status the Rust core records on accept); create_server's upstream binding executes it for you before handle_accepted, as upstream does.
template<typename A>
template<typename F>
Iterate over every currently live goal and invoke f(uuid, status).
F must be a stateless callable convertible to void (*)(const uint8_t uuid[16], GoalStatus status). The arena never stores the original goal CDR payload, so only identity + status are forwarded — if you need the goal bytes, stash them in a {uuid → state} table from inside set_goal_callback. F must be a stateless callable convertible to void(*)(const uint8_t[16], GoalStatus). phase-456 W3b — the visitor rides the void* ctx this FFI already has, carried by value through rclcpp::detail::fn_to_context, instead of a TypedVisitorFn user_visitor_fn_ member set on entry and cleared on exit. That member was the only piece of per-instance state on this class that was nullptr everywhere except inside one function body, and the move constructor and move assignment each copied it — bookkeeping for a value known to be null at every point a move can observe it.
The lifetime argument is stronger here than the one W3 made for a service handler: this FFI call is SYNCHRONOUS, so the context does not outlive the full-expression that built it. Nothing of the caller's is referenced after the call returns, which is also why the visitor needs no clearing step — there is nowhere for it to be left behind.
Read back the action name this server was created on — phase-417 W4.b.
The callback tier's half of "four surfaces, one accessor" (ledger row c:action_server_get_action_name): PollingActionServer and PollingActionClient have had get_action_name() all along, C now has rcl_action_server_get_action_name, and this tier — the one a ported rclcpp_action program uses — had a char action_name_[256] field populated at construction and read by nothing.
The field is back, and it is now READ. The earlier removal was right about dead state and the note it left ("if an accessor is wanted, it
belongs on an FFI getter over the name the runtime already owns") does not apply: the runtime does NOT own it here. CppActionServer keeps a raw arena handle and nros_cpp_action_server_create takes _action_name and drops it, so there is nothing FFI-side to hand back. Subscription::get_topic_name pays the same 256 bytes for the same reason, and a borrowed const char* was rejected — create_action_server takes a const char* that a hosted caller may well have obtained from a temporary.
Returns "" (never NULL) on an uninitialised server, matching Subscription::get_topic_name and the two polling tiers.
template<typename A>
template<typename F>
Register a callback invoked once per ACCEPTED goal (issue 0796).
Fires after the accept reply has reached the client, for GoalResponse::ACCEPT_AND_EXECUTE and GoalResponse::ACCEPT_AND_DEFER alike. This is where a deferred goal starts executing: the goal callback answers accept/reject and must return promptly, so it is the wrong place to begin work.
Upstream's handle_accepted receives an owning std::shared_ptr<ServerGoalHandle>; this callback receives the 16-byte goal id instead, and the goal is driven through this server (publish_feedback, succeed, ...) because goals live in the server's static arena.
Mirrors C's rclc_accepted_callback_t (passed at rclc_action_server_init_with_callbacks) and Rust's third argument to create_action_server_with_callbacks(goal, cancel, accepted). Without it a C++ user who returned ACCEPT_AND_DEFER was never told the goal had been accepted.
F must be a stateless callable convertible to TypedAcceptedFn.
Terminate goal_id as SUCCEEDED — phase-417 W4.b.
C has rclc_action_succeed / _abort / _canceled, Rust has ActionServerHandle::succeed / abort / canceled, and every rclcpp_action server ends with goal_handle->succeed(result). C++ had only complete_goal, so the terminal line of a ported server was one nobody could keep. These three are FORWARDERS onto complete_goal: the goal state machine stays Rust-side (RFC-0019), and no state is added here.
complete_goal remains the general form for a status computed at runtime.
Upstream's is goal_handle->succeed(std::shared_ptr<Result>). Ours is on the server, keyed by goal id, result by const reference: there is no goal handle and no shared_ptr (goals live in the server's static arena).