10#ifndef NROS_RCLCPP_ACTION_SERVER_HPP
11#define NROS_RCLCPP_ACTION_SERVER_HPP
17#include "rclcpp/detail/callback_context.hpp"
19#include "rclcpp/detail/entity_name.hpp"
20#include "rclcpp/owned.hpp"
22#include "rclcpp_action/detail/upstream.hpp"
26#include "rclcpp/size_bound.hpp"
38#include "rclcpp/detail/nros_cpp_ffi.h"
42 size_t len,
void* ctx);
72 static nros_cpp_action_hashes_t
get() {
73 nros_cpp_action_hashes_t h = {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr};
80 typename nros_void_<
decltype(A::SEND_GOAL_SERVICE_HASH)>::type> {
81 static nros_cpp_action_hashes_t
get() {
82 nros_cpp_action_hashes_t h = {A::SEND_GOAL_SERVICE_HASH, A::CANCEL_GOAL_SERVICE_HASH,
83 A::GET_RESULT_SERVICE_HASH, A::FEEDBACK_MESSAGE_HASH,
84 A::STATUS_MESSAGE_HASH};
138 for (
size_t i = 0; i <
SIZE; ++i) {
149 for (
size_t i = 0; i <
SIZE; ++i) {
150 if (
uuid[i] != 0)
return false;
156 for (
size_t i = 0; i <
SIZE; ++i) {
157 if (
uuid[i] != other.
uuid[i])
return false;
168 for (
size_t i = 0; i <
SIZE; ++i) {
175static_assert(
sizeof(GoalUUID) == 16,
176 "rclcpp_action::GoalUUID must be exactly the 16 bytes the FFI passes as uint8_t[16]");
177static_assert(
alignof(GoalUUID) ==
alignof(uint8_t),
178 "rclcpp_action::GoalUUID must not add alignment over its uint8_t[16]");
245 return (r == CancelResponse::ACCEPT) ? 1 : 0;
306template <
typename A>
class ServerGoalHandle;
392 user_goal_fn_ctx_ =
nullptr;
393 user_goal_ctx_ =
nullptr;
394 return install_callbacks();
406 user_goal_fn_ctx_ = f;
407 user_goal_ctx_ = ctx;
408 user_goal_fn_ =
nullptr;
409 return install_callbacks();
418 user_cancel_fn_ctx_ =
nullptr;
419 user_cancel_ctx_ =
nullptr;
420 return install_callbacks();
431 user_cancel_fn_ctx_ = f;
432 user_cancel_ctx_ = ctx;
433 user_cancel_fn_ =
nullptr;
434 return install_callbacks();
460 user_accepted_fn_ctx_ =
nullptr;
461 user_accepted_ctx_ =
nullptr;
462 return install_callbacks();
471 user_accepted_fn_ctx_ = f;
472 user_accepted_ctx_ = ctx;
473 user_accepted_fn_ =
nullptr;
474 return install_callbacks();
489 uint8_t buf[::rclcpp::detail::buffer_bounds<FeedbackType>::tx];
491 if (FeedbackType::ffi_serialize(&feedback, buf,
sizeof(buf), &len) != 0) {
494 return ::rclcpp::Result(nros_cpp_action_server_publish_feedback(
495 storage_, executor_,
reinterpret_cast<const uint8_t(*)[16]
>(goal_id), buf, len));
515 uint8_t buf[::rclcpp::detail::buffer_bounds<ResultType>::tx];
517 if (ResultType::ffi_serialize(&result, buf,
sizeof(buf), &len) != 0) {
520 return ::rclcpp::Result(nros_cpp_action_server_complete_goal(
521 storage_, executor_,
reinterpret_cast<const uint8_t(*)[16]
>(goal_id),
522 static_cast<int32_t
>(status), buf, len));
565 return ::rclcpp::Result(nros_cpp_action_server_execute(
566 storage_, executor_,
reinterpret_cast<const uint8_t(*)[16]
>(goal_id)));
571 return execute(goal_id.data());
654 auto trampoline = [](
const uint8_t goal_id[16], int8_t status,
void* ctx) {
655 TypedVisitorFn fn = ::rclcpp::detail::fn_from_context<TypedVisitorFn>(ctx);
656 if (fn ==
nullptr)
return;
659 return ::rclcpp::Result(nros_cpp_action_server_for_each_active_goal(
661 reinterpret_cast<void (*)(
const uint8_t(*)[16], int8_t,
void*)
>(+trampoline),
662 ::rclcpp::detail::fn_to_context(visitor)));
697 if (!initialized_)
return false;
698 return nros_cpp_action_server_goal_exists(storage_, executor_,
699 reinterpret_cast<const uint8_t(*)[16]
>(goal_id));
703 bool goal_exists(const ::rclcpp_action::GoalUUID& goal_id)
const {
726 nros_cpp_action_server_detach(storage_, executor_);
727 nros_cpp_action_server_destroy(storage_);
728 initialized_ =
false;
740 : executor_(other.executor_), user_goal_fn_(other.user_goal_fn_),
741 user_goal_fn_ctx_(other.user_goal_fn_ctx_), user_goal_ctx_(other.user_goal_ctx_),
742 user_cancel_fn_(other.user_cancel_fn_), user_cancel_fn_ctx_(other.user_cancel_fn_ctx_),
743 user_cancel_ctx_(other.user_cancel_ctx_), user_accepted_fn_(other.user_accepted_fn_),
744 user_accepted_fn_ctx_(other.user_accepted_fn_ctx_),
745 user_accepted_ctx_(other.user_accepted_ctx_), action_name_{},
746 initialized_(other.initialized_),
747 upstream_(static_cast<
detail::HostedBox&&>(other.upstream_)) {
748 ::memcpy(action_name_, other.action_name_,
sizeof(action_name_));
749 if (other.initialized_) {
750 nros_cpp_action_server_relocate(other.storage_, storage_);
752 (void)nros_cpp_action_server_retarget(storage_, executor_);
753 other.initialized_ =
false;
754 (void)install_callbacks();
760 if (
this != &other) {
765 nros_cpp_action_server_detach(storage_, executor_);
766 nros_cpp_action_server_destroy(storage_);
768 executor_ = other.executor_;
769 user_goal_fn_ = other.user_goal_fn_;
770 user_goal_fn_ctx_ = other.user_goal_fn_ctx_;
771 user_goal_ctx_ = other.user_goal_ctx_;
772 user_cancel_fn_ = other.user_cancel_fn_;
773 user_cancel_fn_ctx_ = other.user_cancel_fn_ctx_;
774 user_cancel_ctx_ = other.user_cancel_ctx_;
775 user_accepted_fn_ = other.user_accepted_fn_;
776 user_accepted_fn_ctx_ = other.user_accepted_fn_ctx_;
777 user_accepted_ctx_ = other.user_accepted_ctx_;
778 ::memcpy(action_name_, other.action_name_,
sizeof(action_name_));
779 initialized_ = other.initialized_;
780 upstream_ =
static_cast<detail::HostedBox&&
>(other.upstream_);
781 if (other.initialized_) {
782 nros_cpp_action_server_relocate(other.storage_, storage_);
784 (void)nros_cpp_action_server_retarget(storage_, executor_);
785 other.initialized_ =
false;
786 (void)install_callbacks();
796 : executor_(nullptr), user_goal_fn_(nullptr), user_goal_fn_ctx_(nullptr),
797 user_goal_ctx_(nullptr), user_cancel_fn_(nullptr), user_cancel_fn_ctx_(nullptr),
798 user_cancel_ctx_(nullptr), user_accepted_fn_(nullptr), user_accepted_fn_ctx_(nullptr),
799 user_accepted_ctx_(nullptr), action_name_{}, initialized_(false) {}
805 friend class ::rclcpp::Node;
808 friend class ::rclcpp_action::ServerGoalHandle<A>;
812 bool goal_status(
const uint8_t goal_id[16], int8_t& out) {
813 if (!initialized_)
return false;
818 } q = {goal_id, 0,
false};
819 auto visit = [](
const uint8_t(*
id)[16], int8_t status,
void* ctx) {
820 Query* qq =
static_cast<Query*
>(ctx);
821 if (::memcmp(*
id, qq->id, 16) == 0) {
826 if (nros_cpp_action_server_for_each_active_goal(storage_, executor_, +visit, &q) != 0)
838 static int32_t goal_trampoline(
const uint8_t goal_id[16],
const uint8_t* data,
size_t len,
840 auto* self =
static_cast<Server*
>(ctx);
843 if (GoalType::ffi_deserialize(data, len, &g) != 0) {
846 if (self->user_goal_fn_ctx_ !=
nullptr) {
847 return ::rclcpp_action::to_ffi(
848 self->user_goal_fn_ctx_(goal_id, g, self->user_goal_ctx_));
850 if (self->user_goal_fn_ !=
nullptr) {
851 return ::rclcpp_action::to_ffi(self->user_goal_fn_(goal_id, g));
856 static int32_t cancel_trampoline(
const uint8_t goal_id[16],
void* ctx) {
857 auto* self =
static_cast<Server*
>(ctx);
858 if (!self) return ::rclcpp_action::to_ffi(::rclcpp_action::CancelResponse::ACCEPT);
859 if (self->user_cancel_fn_ctx_ !=
nullptr) {
860 return ::rclcpp_action::to_ffi(
861 self->user_cancel_fn_ctx_(goal_id, self->user_cancel_ctx_));
863 if (self->user_cancel_fn_ !=
nullptr) {
864 return ::rclcpp_action::to_ffi(self->user_cancel_fn_(goal_id));
866 return ::rclcpp_action::to_ffi(::rclcpp_action::CancelResponse::ACCEPT);
869 static void accepted_trampoline(
const uint8_t goal_id[16],
void* ctx) {
870 auto* self =
static_cast<Server*
>(ctx);
872 if (self->user_accepted_fn_ctx_ !=
nullptr) {
873 self->user_accepted_fn_ctx_(goal_id, self->user_accepted_ctx_);
876 if (self->user_accepted_fn_ !=
nullptr) {
877 self->user_accepted_fn_(goal_id);
882 bool goal_set = (user_goal_fn_ !=
nullptr) || (user_goal_fn_ctx_ !=
nullptr);
883 bool cancel_set = (user_cancel_fn_ !=
nullptr) || (user_cancel_fn_ctx_ !=
nullptr);
884 bool accepted_set = (user_accepted_fn_ !=
nullptr) || (user_accepted_fn_ctx_ !=
nullptr);
888 if (ret != 0) return ::rclcpp::Result(ret);
898 alignas(8) uint8_t storage_[NROS_CPP_ACTION_SERVER_STORAGE_SIZE];
900 TypedGoalFn user_goal_fn_;
901 TypedGoalFnWithCtx user_goal_fn_ctx_;
902 void* user_goal_ctx_;
903 TypedCancelFn user_cancel_fn_;
904 TypedCancelFnWithCtx user_cancel_fn_ctx_;
905 void* user_cancel_ctx_;
906 TypedAcceptedFn user_accepted_fn_;
907 TypedAcceptedFnWithCtx user_accepted_fn_ctx_;
908 void* user_accepted_ctx_;
921 detail::HostedBox upstream_;
945#ifdef NROS_CPP_HAS_SHARED_PTR
946 using SharedPtr = ::std::shared_ptr<ServerGoalHandle>;
954 : server_(server), uuid_(uuid), goal_() {}
969 if (server_ !=
nullptr) (void)server_->execute(uuid_.data());
978#ifdef NROS_CPP_HAS_SHARED_PTR
980 ::std::shared_ptr<const Goal> get_goal() const {
981 auto* g = goal_.template as<::std::shared_ptr<const Goal>>();
982 return g !=
nullptr ? *g : ::std::shared_ptr<const Goal>();
985 void publish_feedback(::std::shared_ptr<Feedback> feedback) {
986 if (feedback && server_ !=
nullptr)
987 (void)server_->publish_feedback(uuid_.data(), *feedback);
990 void succeed(::std::shared_ptr<Result> result) { terminate(GoalStatus::Succeeded, result); }
992 void abort(::std::shared_ptr<Result> result) { terminate(GoalStatus::Aborted, result); }
994 void canceled(::std::shared_ptr<Result> result) { terminate(GoalStatus::Canceled, result); }
998 friend struct detail::ServerUpstream<A>;
1002 if (server_ ==
nullptr || !server_->goal_status(uuid_.data(), s))
1003 return GoalStatus::Unknown;
1007#ifdef NROS_CPP_HAS_SHARED_PTR
1008 void terminate(GoalStatus status, const ::std::shared_ptr<Result>& result) {
1009 if (server_ ==
nullptr)
return;
1011 (void)server_->complete_goal(uuid_.data(), status, result ? *result : empty);
1012 detail::ServerUpstream<A>::forget(*server_, uuid_);
1019 detail::HostedBox goal_;
1035#ifdef NROS_CPP_HAS_SHARED_PTR
1036 if (State* st = s.upstream_.template as<State>()) st->server = &s;
1042#ifdef NROS_CPP_HAS_SHARED_PTR
1044 using CancelFn = ::std::function<
CancelResponse(::std::shared_ptr<Handle>)>;
1045 using AcceptedFn = ::std::function<void(::std::shared_ptr<Handle>)>;
1049 ::std::shared_ptr<const Goal> goal;
1057 AcceptedFn accepted;
1059 ::std::vector<Entry> goals;
1062 static void destroy(
void* p) {
delete static_cast<State*
>(p); }
1064 template <
typename G,
typename C,
typename Acc>
1065 static ::rclcpp::Result bind(Server<A>& s, G&& goal, C&&
cancel, Acc&& accepted) {
1066 State* st =
new State{GoalFn(
static_cast<G&&
>(goal)),
1067 CancelFn(
static_cast<C&&
>(
cancel)),
1068 AcceptedFn(
static_cast<Acc&&
>(accepted)),
1071 s.upstream_.reset(st, &destroy);
1073 if (r.
ok()) r = s.set_cancel_callback_with_ctx(&on_cancel, st);
1074 if (r.
ok()) r = s.set_accepted_callback_with_ctx(&on_accepted, st);
1079 static void forget(Server<A>& s,
const GoalUUID&
id) {
1080 State* st = s.upstream_.template as<State>();
1081 if (st ==
nullptr)
return;
1082 for (
size_t i = 0; i < st->goals.size(); ++i) {
1083 if (st->goals[i].id ==
id) {
1084 st->goals.erase(st->goals.begin() +
static_cast<long>(i));
1091 static ::std::shared_ptr<Handle> make_handle(State* st,
const GoalUUID&
id) {
1092 ::std::shared_ptr<Handle> h = ::std::make_shared<Handle>(st->server,
id);
1093 for (
const Entry& e : st->goals) {
1095 h->goal_.reset(new ::std::shared_ptr<const Goal>(e.goal), [](
void* p) {
1096 delete static_cast<::std::shared_ptr<const Goal>*>(p);
1104 static GoalResponse on_goal(
const uint8_t uuid[16],
const Goal& goal,
void* ctx) {
1105 State* st =
static_cast<State*
>(ctx);
1106 if (!st->goal)
return GoalResponse::REJECT;
1107 const GoalUUID id(uuid);
1108 ::std::shared_ptr<const Goal> msg = ::std::make_shared<const Goal>(goal);
1110 if (r != GoalResponse::REJECT) {
1111 forget(*st->server,
id);
1112 st->goals.push_back(Entry{id, msg, r == GoalResponse::ACCEPT_AND_EXECUTE});
1117 static CancelResponse on_cancel(
const uint8_t uuid[16],
void* ctx) {
1118 State* st =
static_cast<State*
>(ctx);
1119 if (!st->cancel)
return CancelResponse::REJECT;
1120 return st->cancel(make_handle(st, GoalUUID(uuid)));
1123 static void on_accepted(
const uint8_t uuid[16],
void* ctx) {
1124 State* st =
static_cast<State*
>(ctx);
1125 const GoalUUID id(uuid);
1130 for (
const Entry& e : st->goals) {
1132 if (e.execute) (void)st->server->execute(uuid);
1136 if (st->accepted) st->accepted(make_handle(st,
id));
1151template <
typename A>
1153 const ::rclcpp::QoS& qos,
1154 const ::rclcpp::ActionServerOptions& options) {
1157 nros_cpp_ret_t ret = nros_cpp_action_server_create(&handle_, action_name, A::TYPE_NAME,
1158 A::Goal::TYPE_HASH, ffi_qos, out.storage_);
1159 if (ret != 0)
return Result(ret);
1166 uint8_t sched = (options.sched_context == ::rclcpp::SCHED_CONTEXT_UNSET)
1168 :
static_cast<uint8_t
>(options.sched_context);
1170 ret = nros_cpp_action_server_register(out.storage_, executor_handle_, action_name, A::TYPE_NAME,
1171 A::Goal::TYPE_HASH, &hashes, sched);
1173 out.executor_ = executor_handle_;
1178 ::rclcpp::detail::assign_entity_name(out.action_name_, action_name);
1179 out.initialized_ =
true;
Result create_action_server(::rclcpp_action::Server< A > &out, const char *action_name, const ::rclcpp::QoS &qos=::rclcpp::QoS::services(), const ::rclcpp::ActionServerOptions &options={})
Definition server.hpp:1152
bool ok() const
Returns true if the operation succeeded.
Definition result.hpp:227
Definition server.hpp:940
detail::Refused< ServerGoalHandle > SharedPtr
Definition server.hpp:949
ServerGoalHandle(Server< A > *server, const GoalUUID &uuid)
Definition server.hpp:953
typename A::Feedback Feedback
Definition server.hpp:943
typename A::Goal Goal
Definition server.hpp:942
typename A::Result Result
Definition server.hpp:944
detail::Refused< ServerGoalHandle > ConstSharedPtr
Definition server.hpp:950
void execute()
Definition server.hpp:968
bool is_active() const
The goal has not reached a terminal state.
Definition server.hpp:972
bool is_canceling() const
The goal is CANCELING: a cancel request for it was accepted.
Definition server.hpp:959
bool is_executing() const
The goal is EXECUTING.
Definition server.hpp:961
const GoalUUID & get_goal_id() const
The goal's id.
Definition server.hpp:957
Definition server.hpp:351
void(*)(const uint8_t uuid[16], ::rclcpp_action::GoalStatus status) TypedVisitorFn
User-facing visitor signature for for_each_active_goal.
Definition server.hpp:381
~Server()
Definition server.hpp:724
::rclcpp::Owned< Server > SharedPtr
Definition server.hpp:361
::rclcpp::Result abort(const ::rclcpp_action::GoalUUID &goal_id, const ResultType &result)
abort taking a GoalUUID value.
Definition server.hpp:620
::rclcpp::Result complete_goal(const uint8_t goal_id[16], const ResultType &result)
Definition server.hpp:527
::rclcpp::Result abort(const uint8_t goal_id[16], const ResultType &result)
Definition server.hpp:598
::rclcpp_action::GoalResponse(*)(const uint8_t uuid[16], const GoalType &goal, void *ctx) TypedGoalFnWithCtx
User-facing typed goal callback signature with user context (Phase 84.G9).
Definition server.hpp:369
::rclcpp::Result publish_feedback(const uint8_t goal_id[16], const FeedbackType &feedback)
Definition server.hpp:486
::rclcpp::Result complete_goal(const uint8_t goal_id[16], ::rclcpp_action::GoalStatus status, const ResultType &result)
Definition server.hpp:511
::rclcpp::Result set_goal_callback_with_ctx(TypedGoalFnWithCtx f, void *ctx)
Definition server.hpp:404
bool goal_exists(const ::rclcpp_action::GoalUUID &goal_id) const
goal_exists taking a GoalUUID value.
Definition server.hpp:703
::rclcpp::Result set_accepted_callback_with_ctx(TypedAcceptedFnWithCtx f, void *ctx)
Definition server.hpp:469
::rclcpp::Result set_cancel_callback(F f)
Definition server.hpp:415
typename A::Feedback FeedbackType
Definition server.hpp:355
::rclcpp::Result succeed(const ::rclcpp_action::GoalUUID &goal_id, const ResultType &result)
succeed taking a GoalUUID value.
Definition server.hpp:615
::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).
Definition server.hpp:538
::rclcpp::Result canceled(const uint8_t goal_id[16], const ResultType &result)
Definition server.hpp:610
const char * get_action_name() const
Definition server.hpp:687
Server(Server &&other)
Definition server.hpp:739
Server()
Definition server.hpp:795
void(*)(const uint8_t uuid[16], void *ctx) TypedAcceptedFnWithCtx
User-facing typed accepted-goal callback signature with user context.
Definition server.hpp:379
::rclcpp::Result canceled(const ::rclcpp_action::GoalUUID &goal_id, const ResultType &result)
canceled taking a GoalUUID value.
Definition server.hpp:625
Server & operator=(Server &&other)
Definition server.hpp:759
void(*)(const uint8_t uuid[16]) TypedAcceptedFn
User-facing typed accepted-goal callback signature (issue 0796).
Definition server.hpp:377
::rclcpp_action::CancelResponse(*)(const uint8_t uuid[16], void *ctx) TypedCancelFnWithCtx
User-facing typed cancel callback signature with user context (Phase 84.G9).
Definition server.hpp:374
::rclcpp::Result set_goal_callback(F f)
Definition server.hpp:389
::rclcpp::Result execute(const ::rclcpp_action::GoalUUID &goal_id)
execute taking a GoalUUID value.
Definition server.hpp:570
::rclcpp::Result set_accepted_callback(F f)
Definition server.hpp:457
::rclcpp::Result publish_feedback(const ::rclcpp_action::GoalUUID &goal_id, const FeedbackType &feedback)
publish_feedback taking a GoalUUID value (phase-417 W4.b).
Definition server.hpp:532
::rclcpp_action::GoalResponse(*)(const uint8_t uuid[16], const GoalType &goal) TypedGoalFn
User-facing typed goal callback signature.
Definition server.hpp:366
bool goal_exists(const uint8_t goal_id[16]) const
Definition server.hpp:696
::rclcpp::Result set_cancel_callback_with_ctx(TypedCancelFnWithCtx f, void *ctx)
Definition server.hpp:429
typename A::Goal GoalType
Definition server.hpp:353
::rclcpp_action::CancelResponse(*)(const uint8_t uuid[16]) TypedCancelFn
User-facing typed cancel callback signature.
Definition server.hpp:372
bool is_valid() const
Check if the action server is initialized and valid.
Definition server.hpp:708
::rclcpp_action::ServerGoalHandle< A > GoalHandle
Upstream's rclcpp_action::ServerGoalHandle<A> for this action.
Definition server.hpp:363
::rclcpp::Result complete_goal(const ::rclcpp_action::GoalUUID &goal_id, const ResultType &result)
complete_goal taking a GoalUUID value (phase-417 W4.b).
Definition server.hpp:544
typename A::Result ResultType
Definition server.hpp:354
::rclcpp::Result for_each_active_goal(F f)
Definition server.hpp:650
::rclcpp::Result succeed(const uint8_t goal_id[16], const ResultType &result)
Definition server.hpp:590
::rclcpp::Result execute(const uint8_t goal_id[16])
Definition server.hpp:563
Inline storage-size macros for opaque entity buffers.
int nros_cpp_ret_t
Definition future.hpp:25
Definition rclcpp.hpp:418
constexpr nros_cpp_qos_t qos_to_ffi(const QoS &qos)
Definition qos.hpp:719
nros_cpp_action_hashes_t action_endpoint_hashes()
Definition server.hpp:89
Definition server.hpp:307
constexpr int32_t to_ffi(GoalResponse r)
Definition server.hpp:236
CancelResponse
Definition server.hpp:226
@ ACCEPT
Definition server.hpp:228
GoalStatus
Definition server.hpp:264
@ Canceled
Definition server.hpp:270
@ Accepted
Definition server.hpp:266
@ Executing
Definition server.hpp:267
@ Succeeded
Definition server.hpp:269
@ Aborted
Definition server.hpp:271
@ Canceling
Definition server.hpp:268
@ Unknown
Definition server.hpp:265
static const size_t ACTION_NAME_MAX
Definition server.hpp:191
Client & operator=(Client &&other)
Definition client.hpp:1002
GoalResponse
Definition server.hpp:206
@ ACCEPT_AND_DEFER
Definition server.hpp:209
@ REJECT
Definition server.hpp:207
@ ACCEPT_AND_EXECUTE
Definition server.hpp:208
CancelReturnCode
Definition server.hpp:255
@ Ok
Definition server.hpp:256
@ Rejected
Definition server.hpp:257
@ GoalTerminated
Definition server.hpp:259
@ UnknownGoal
Definition server.hpp:258
@ Error
Generic failure not covered by a more specific code.
Definition result.hpp:118
@ NotInitialized
Definition result.hpp:131
ResultOf< void > Result
Definition result.hpp:247
rclcpp::Node and global session helpers.
**auto handle
Definition client.hpp:127
typename A::Goal GoalType
Definition client.hpp:480
detail::Refused< Client > CancelResponse
Definition client.hpp:499
rclcpp::Result, rclcpp::ErrorCode, and the RCLCPP_TRY macro.
int32_t(* nros_cpp_goal_callback_t)(const uint8_t goal_id[16], const uint8_t *data, size_t len, void *ctx)
Definition server.hpp:41
nros_cpp_ret_t nros_cpp_action_server_set_callbacks(void *handle, nros_cpp_goal_callback_t goal_cb, nros_cpp_cancel_callback_t cancel_cb, void *ctx)
int32_t(* nros_cpp_cancel_callback_t)(const uint8_t goal_id[16], void *ctx)
Definition server.hpp:43
nros_cpp_ret_t nros_cpp_action_server_set_accepted_callback(void *handle, nros_cpp_accepted_callback_t accepted_cb, void *ctx)
void(* nros_cpp_accepted_callback_t)(const uint8_t goal_id[16], void *ctx)
Definition server.hpp:48
static nros_cpp_action_hashes_t get()
Definition server.hpp:81
static nros_cpp_action_hashes_t get()
Definition server.hpp:72
void type
Definition server.hpp:68
Definition server.hpp:126
bool operator!=(const GoalUUID &other) const
Definition server.hpp:162
static const size_t SIZE
Byte count — unique_identifier_msgs/UUID is a fixed uint8[16].
Definition server.hpp:128
bool operator==(const GoalUUID &other) const
Definition server.hpp:155
const uint8_t * data() const
Definition server.hpp:145
bool is_zero() const
True when every byte is zero — mirrors nros_core::GoalId::is_zero().
Definition server.hpp:148
uint8_t uuid[16]
UUID bytes, in wire order.
Definition server.hpp:131
GoalUUID()
The zero ("null") goal id — mirrors nros_core::GoalId::zero().
Definition server.hpp:134
uint8_t * data()
Pointer to the 16 bytes — what the raw-array overloads and the FFI take.
Definition server.hpp:144
GoalUUID(const uint8_t *src)
Copy the 16 bytes at src, which must point to at least that many.
Definition server.hpp:137
bool operator<(const GoalUUID &other) const
Definition server.hpp:167
Definition server.hpp:1029
static void rehome(Server< A > &s)
Point the bound state at s after a move.
Definition server.hpp:1034
typename A::Goal Goal
Definition server.hpp:1030
ServerGoalHandle< A > Handle
Definition server.hpp:1031