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;
305template <
typename A>
class ServerGoalHandle;
391 user_goal_fn_ctx_ =
nullptr;
392 user_goal_ctx_ =
nullptr;
393 return install_callbacks();
405 user_goal_fn_ctx_ = f;
406 user_goal_ctx_ = ctx;
407 user_goal_fn_ =
nullptr;
408 return install_callbacks();
417 user_cancel_fn_ctx_ =
nullptr;
418 user_cancel_ctx_ =
nullptr;
419 return install_callbacks();
430 user_cancel_fn_ctx_ = f;
431 user_cancel_ctx_ = ctx;
432 user_cancel_fn_ =
nullptr;
433 return install_callbacks();
459 user_accepted_fn_ctx_ =
nullptr;
460 user_accepted_ctx_ =
nullptr;
461 return install_callbacks();
470 user_accepted_fn_ctx_ = f;
471 user_accepted_ctx_ = ctx;
472 user_accepted_fn_ =
nullptr;
473 return install_callbacks();
488 uint8_t buf[::rclcpp::detail::buffer_bounds<FeedbackType>::tx];
490 if (FeedbackType::ffi_serialize(&feedback, buf,
sizeof(buf), &len) != 0) {
493 return ::rclcpp::Result(nros_cpp_action_server_publish_feedback(
494 storage_, executor_,
reinterpret_cast<const uint8_t(*)[16]
>(goal_id), buf, len));
514 uint8_t buf[::rclcpp::detail::buffer_bounds<ResultType>::tx];
516 if (ResultType::ffi_serialize(&result, buf,
sizeof(buf), &len) != 0) {
519 return ::rclcpp::Result(nros_cpp_action_server_complete_goal(
520 storage_, executor_,
reinterpret_cast<const uint8_t(*)[16]
>(goal_id),
521 static_cast<int32_t
>(status), buf, len));
564 return ::rclcpp::Result(nros_cpp_action_server_execute(
565 storage_, executor_,
reinterpret_cast<const uint8_t(*)[16]
>(goal_id)));
570 return execute(goal_id.data());
653 auto trampoline = [](
const uint8_t goal_id[16], int8_t status,
void* ctx) {
654 TypedVisitorFn fn = ::rclcpp::detail::fn_from_context<TypedVisitorFn>(ctx);
655 if (fn ==
nullptr)
return;
658 return ::rclcpp::Result(nros_cpp_action_server_for_each_active_goal(
660 reinterpret_cast<void (*)(
const uint8_t(*)[16], int8_t,
void*)
>(+trampoline),
661 ::rclcpp::detail::fn_to_context(visitor)));
696 if (!initialized_)
return false;
697 return nros_cpp_action_server_goal_exists(storage_, executor_,
698 reinterpret_cast<const uint8_t(*)[16]
>(goal_id));
702 bool goal_exists(const ::rclcpp_action::GoalUUID& goal_id)
const {
725 nros_cpp_action_server_detach(storage_, executor_);
726 nros_cpp_action_server_destroy(storage_);
727 initialized_ =
false;
739 : executor_(other.executor_), user_goal_fn_(other.user_goal_fn_),
740 user_goal_fn_ctx_(other.user_goal_fn_ctx_), user_goal_ctx_(other.user_goal_ctx_),
741 user_cancel_fn_(other.user_cancel_fn_), user_cancel_fn_ctx_(other.user_cancel_fn_ctx_),
742 user_cancel_ctx_(other.user_cancel_ctx_), user_accepted_fn_(other.user_accepted_fn_),
743 user_accepted_fn_ctx_(other.user_accepted_fn_ctx_),
744 user_accepted_ctx_(other.user_accepted_ctx_), action_name_{},
745 initialized_(other.initialized_),
746 upstream_(static_cast<
detail::HostedBox&&>(other.upstream_)) {
747 ::memcpy(action_name_, other.action_name_,
sizeof(action_name_));
748 if (other.initialized_) {
749 nros_cpp_action_server_relocate(other.storage_, storage_);
751 (void)nros_cpp_action_server_retarget(storage_, executor_);
752 other.initialized_ =
false;
753 (void)install_callbacks();
759 if (
this != &other) {
764 nros_cpp_action_server_detach(storage_, executor_);
765 nros_cpp_action_server_destroy(storage_);
767 executor_ = other.executor_;
768 user_goal_fn_ = other.user_goal_fn_;
769 user_goal_fn_ctx_ = other.user_goal_fn_ctx_;
770 user_goal_ctx_ = other.user_goal_ctx_;
771 user_cancel_fn_ = other.user_cancel_fn_;
772 user_cancel_fn_ctx_ = other.user_cancel_fn_ctx_;
773 user_cancel_ctx_ = other.user_cancel_ctx_;
774 user_accepted_fn_ = other.user_accepted_fn_;
775 user_accepted_fn_ctx_ = other.user_accepted_fn_ctx_;
776 user_accepted_ctx_ = other.user_accepted_ctx_;
777 ::memcpy(action_name_, other.action_name_,
sizeof(action_name_));
778 initialized_ = other.initialized_;
779 upstream_ =
static_cast<detail::HostedBox&&
>(other.upstream_);
780 if (other.initialized_) {
781 nros_cpp_action_server_relocate(other.storage_, storage_);
783 (void)nros_cpp_action_server_retarget(storage_, executor_);
784 other.initialized_ =
false;
785 (void)install_callbacks();
795 : executor_(nullptr), user_goal_fn_(nullptr), user_goal_fn_ctx_(nullptr),
796 user_goal_ctx_(nullptr), user_cancel_fn_(nullptr), user_cancel_fn_ctx_(nullptr),
797 user_cancel_ctx_(nullptr), user_accepted_fn_(nullptr), user_accepted_fn_ctx_(nullptr),
798 user_accepted_ctx_(nullptr), action_name_{}, initialized_(false) {}
804 friend class ::rclcpp::Node;
807 friend class ::rclcpp_action::ServerGoalHandle<A>;
811 bool goal_status(
const uint8_t goal_id[16], int8_t& out) {
812 if (!initialized_)
return false;
817 } q = {goal_id, 0,
false};
818 auto visit = [](
const uint8_t(*
id)[16], int8_t status,
void* ctx) {
819 Query* qq =
static_cast<Query*
>(ctx);
820 if (::memcmp(*
id, qq->id, 16) == 0) {
825 if (nros_cpp_action_server_for_each_active_goal(storage_, executor_, +visit, &q) != 0)
837 static int32_t goal_trampoline(
const uint8_t goal_id[16],
const uint8_t* data,
size_t len,
839 auto* self =
static_cast<Server*
>(ctx);
842 if (GoalType::ffi_deserialize(data, len, &g) != 0) {
845 if (self->user_goal_fn_ctx_ !=
nullptr) {
846 return ::rclcpp_action::to_ffi(
847 self->user_goal_fn_ctx_(goal_id, g, self->user_goal_ctx_));
849 if (self->user_goal_fn_ !=
nullptr) {
850 return ::rclcpp_action::to_ffi(self->user_goal_fn_(goal_id, g));
855 static int32_t cancel_trampoline(
const uint8_t goal_id[16],
void* ctx) {
856 auto* self =
static_cast<Server*
>(ctx);
857 if (!self) return ::rclcpp_action::to_ffi(::rclcpp_action::CancelResponse::ACCEPT);
858 if (self->user_cancel_fn_ctx_ !=
nullptr) {
859 return ::rclcpp_action::to_ffi(
860 self->user_cancel_fn_ctx_(goal_id, self->user_cancel_ctx_));
862 if (self->user_cancel_fn_ !=
nullptr) {
863 return ::rclcpp_action::to_ffi(self->user_cancel_fn_(goal_id));
865 return ::rclcpp_action::to_ffi(::rclcpp_action::CancelResponse::ACCEPT);
868 static void accepted_trampoline(
const uint8_t goal_id[16],
void* ctx) {
869 auto* self =
static_cast<Server*
>(ctx);
871 if (self->user_accepted_fn_ctx_ !=
nullptr) {
872 self->user_accepted_fn_ctx_(goal_id, self->user_accepted_ctx_);
875 if (self->user_accepted_fn_ !=
nullptr) {
876 self->user_accepted_fn_(goal_id);
881 bool goal_set = (user_goal_fn_ !=
nullptr) || (user_goal_fn_ctx_ !=
nullptr);
882 bool cancel_set = (user_cancel_fn_ !=
nullptr) || (user_cancel_fn_ctx_ !=
nullptr);
883 bool accepted_set = (user_accepted_fn_ !=
nullptr) || (user_accepted_fn_ctx_ !=
nullptr);
887 if (ret != 0) return ::rclcpp::Result(ret);
897 alignas(8) uint8_t storage_[NROS_CPP_ACTION_SERVER_STORAGE_SIZE];
899 TypedGoalFn user_goal_fn_;
900 TypedGoalFnWithCtx user_goal_fn_ctx_;
901 void* user_goal_ctx_;
902 TypedCancelFn user_cancel_fn_;
903 TypedCancelFnWithCtx user_cancel_fn_ctx_;
904 void* user_cancel_ctx_;
905 TypedAcceptedFn user_accepted_fn_;
906 TypedAcceptedFnWithCtx user_accepted_fn_ctx_;
907 void* user_accepted_ctx_;
920 detail::HostedBox upstream_;
944#ifdef NROS_CPP_HAS_SHARED_PTR
945 using SharedPtr = ::std::shared_ptr<ServerGoalHandle>;
953 : server_(server), uuid_(uuid), goal_() {}
968 if (server_ !=
nullptr) (void)server_->execute(uuid_.data());
977#ifdef NROS_CPP_HAS_SHARED_PTR
979 ::std::shared_ptr<const Goal> get_goal() const {
980 auto* g = goal_.template as<::std::shared_ptr<const Goal>>();
981 return g !=
nullptr ? *g : ::std::shared_ptr<const Goal>();
984 void publish_feedback(::std::shared_ptr<Feedback> feedback) {
985 if (feedback && server_ !=
nullptr)
986 (void)server_->publish_feedback(uuid_.data(), *feedback);
989 void succeed(::std::shared_ptr<Result> result) { terminate(GoalStatus::Succeeded, result); }
991 void abort(::std::shared_ptr<Result> result) { terminate(GoalStatus::Aborted, result); }
993 void canceled(::std::shared_ptr<Result> result) { terminate(GoalStatus::Canceled, result); }
997 friend struct detail::ServerUpstream<A>;
1001 if (server_ ==
nullptr || !server_->goal_status(uuid_.data(), s))
1002 return GoalStatus::Unknown;
1006#ifdef NROS_CPP_HAS_SHARED_PTR
1007 void terminate(GoalStatus status, const ::std::shared_ptr<Result>& result) {
1008 if (server_ ==
nullptr)
return;
1010 (void)server_->complete_goal(uuid_.data(), status, result ? *result : empty);
1011 detail::ServerUpstream<A>::forget(*server_, uuid_);
1018 detail::HostedBox goal_;
1034#ifdef NROS_CPP_HAS_SHARED_PTR
1035 if (State* st = s.upstream_.template as<State>()) st->server = &s;
1041#ifdef NROS_CPP_HAS_SHARED_PTR
1043 using CancelFn = ::std::function<
CancelResponse(::std::shared_ptr<Handle>)>;
1044 using AcceptedFn = ::std::function<void(::std::shared_ptr<Handle>)>;
1048 ::std::shared_ptr<const Goal> goal;
1056 AcceptedFn accepted;
1058 ::std::vector<Entry> goals;
1061 static void destroy(
void* p) {
delete static_cast<State*
>(p); }
1063 template <
typename G,
typename C,
typename Acc>
1064 static ::rclcpp::Result bind(Server<A>& s, G&& goal, C&&
cancel, Acc&& accepted) {
1065 State* st =
new State{GoalFn(
static_cast<G&&
>(goal)),
1066 CancelFn(
static_cast<C&&
>(
cancel)),
1067 AcceptedFn(
static_cast<Acc&&
>(accepted)),
1070 s.upstream_.reset(st, &destroy);
1072 if (r.
ok()) r = s.set_cancel_callback_with_ctx(&on_cancel, st);
1073 if (r.
ok()) r = s.set_accepted_callback_with_ctx(&on_accepted, st);
1078 static void forget(Server<A>& s,
const GoalUUID&
id) {
1079 State* st = s.upstream_.template as<State>();
1080 if (st ==
nullptr)
return;
1081 for (
size_t i = 0; i < st->goals.size(); ++i) {
1082 if (st->goals[i].id ==
id) {
1083 st->goals.erase(st->goals.begin() +
static_cast<long>(i));
1090 static ::std::shared_ptr<Handle> make_handle(State* st,
const GoalUUID&
id) {
1091 ::std::shared_ptr<Handle> h = ::std::make_shared<Handle>(st->server,
id);
1092 for (
const Entry& e : st->goals) {
1094 h->goal_.reset(new ::std::shared_ptr<const Goal>(e.goal), [](
void* p) {
1095 delete static_cast<::std::shared_ptr<const Goal>*>(p);
1103 static GoalResponse on_goal(
const uint8_t uuid[16],
const Goal& goal,
void* ctx) {
1104 State* st =
static_cast<State*
>(ctx);
1105 if (!st->goal)
return GoalResponse::REJECT;
1106 const GoalUUID id(uuid);
1107 ::std::shared_ptr<const Goal> msg = ::std::make_shared<const Goal>(goal);
1109 if (r != GoalResponse::REJECT) {
1110 forget(*st->server,
id);
1111 st->goals.push_back(Entry{id, msg, r == GoalResponse::ACCEPT_AND_EXECUTE});
1116 static CancelResponse on_cancel(
const uint8_t uuid[16],
void* ctx) {
1117 State* st =
static_cast<State*
>(ctx);
1118 if (!st->cancel)
return CancelResponse::REJECT;
1119 return st->cancel(make_handle(st, GoalUUID(uuid)));
1122 static void on_accepted(
const uint8_t uuid[16],
void* ctx) {
1123 State* st =
static_cast<State*
>(ctx);
1124 const GoalUUID id(uuid);
1129 for (
const Entry& e : st->goals) {
1131 if (e.execute) (void)st->server->execute(uuid);
1135 if (st->accepted) st->accepted(make_handle(st,
id));
1150template <
typename A>
1152 const ::rclcpp::QoS& qos,
1153 const ::rclcpp::ActionServerOptions& options) {
1156 nros_cpp_ret_t ret = nros_cpp_action_server_create(&handle_, action_name, A::TYPE_NAME,
1157 A::Goal::TYPE_HASH, ffi_qos, out.storage_);
1158 if (ret != 0)
return Result(ret);
1165 uint8_t sched = (options.sched_context == ::rclcpp::SCHED_CONTEXT_UNSET)
1167 :
static_cast<uint8_t
>(options.sched_context);
1169 ret = nros_cpp_action_server_register(out.storage_, executor_handle_, action_name, A::TYPE_NAME,
1170 A::Goal::TYPE_HASH, &hashes, sched);
1172 out.executor_ = executor_handle_;
1177 ::rclcpp::detail::assign_entity_name(out.action_name_, action_name);
1178 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:1151
bool ok() const
Returns true if the operation succeeded.
Definition result.hpp:227
Definition server.hpp:939
detail::Refused< ServerGoalHandle > SharedPtr
Definition server.hpp:948
ServerGoalHandle(Server< A > *server, const GoalUUID &uuid)
Definition server.hpp:952
typename A::Feedback Feedback
Definition server.hpp:942
typename A::Goal Goal
Definition server.hpp:941
typename A::Result Result
Definition server.hpp:943
detail::Refused< ServerGoalHandle > ConstSharedPtr
Definition server.hpp:949
void execute()
Definition server.hpp:967
bool is_active() const
The goal has not reached a terminal state.
Definition server.hpp:971
bool is_canceling() const
The goal is CANCELING: a cancel request for it was accepted.
Definition server.hpp:958
bool is_executing() const
The goal is EXECUTING.
Definition server.hpp:960
const GoalUUID & get_goal_id() const
The goal's id.
Definition server.hpp:956
Definition server.hpp:350
void(*)(const uint8_t uuid[16], ::rclcpp_action::GoalStatus status) TypedVisitorFn
User-facing visitor signature for for_each_active_goal.
Definition server.hpp:380
~Server()
Definition server.hpp:723
::rclcpp::Owned< Server > SharedPtr
Definition server.hpp:360
::rclcpp::Result abort(const ::rclcpp_action::GoalUUID &goal_id, const ResultType &result)
abort taking a GoalUUID value.
Definition server.hpp:619
::rclcpp::Result complete_goal(const uint8_t goal_id[16], const ResultType &result)
Definition server.hpp:526
::rclcpp::Result abort(const uint8_t goal_id[16], const ResultType &result)
Definition server.hpp:597
::rclcpp_action::GoalResponse(*)(const uint8_t uuid[16], const GoalType &goal, void *ctx) TypedGoalFnWithCtx
User-facing typed goal callback signature with user context.
Definition server.hpp:368
::rclcpp::Result publish_feedback(const uint8_t goal_id[16], const FeedbackType &feedback)
Definition server.hpp:485
::rclcpp::Result complete_goal(const uint8_t goal_id[16], ::rclcpp_action::GoalStatus status, const ResultType &result)
Definition server.hpp:510
::rclcpp::Result set_goal_callback_with_ctx(TypedGoalFnWithCtx f, void *ctx)
Definition server.hpp:403
bool goal_exists(const ::rclcpp_action::GoalUUID &goal_id) const
goal_exists taking a GoalUUID value.
Definition server.hpp:702
::rclcpp::Result set_accepted_callback_with_ctx(TypedAcceptedFnWithCtx f, void *ctx)
Definition server.hpp:468
::rclcpp::Result set_cancel_callback(F f)
Definition server.hpp:414
typename A::Feedback FeedbackType
Definition server.hpp:354
::rclcpp::Result succeed(const ::rclcpp_action::GoalUUID &goal_id, const ResultType &result)
succeed taking a GoalUUID value.
Definition server.hpp:614
::rclcpp::Result complete_goal(const ::rclcpp_action::GoalUUID &goal_id, ::rclcpp_action::GoalStatus status, const ResultType &result)
complete_goal taking a GoalUUID value.
Definition server.hpp:537
::rclcpp::Result canceled(const uint8_t goal_id[16], const ResultType &result)
Definition server.hpp:609
const char * get_action_name() const
Definition server.hpp:686
Server(Server &&other)
Definition server.hpp:738
Server()
Definition server.hpp:794
void(*)(const uint8_t uuid[16], void *ctx) TypedAcceptedFnWithCtx
User-facing typed accepted-goal callback signature with user context.
Definition server.hpp:378
::rclcpp::Result canceled(const ::rclcpp_action::GoalUUID &goal_id, const ResultType &result)
canceled taking a GoalUUID value.
Definition server.hpp:624
Server & operator=(Server &&other)
Definition server.hpp:758
void(*)(const uint8_t uuid[16]) TypedAcceptedFn
User-facing typed accepted-goal callback signature.
Definition server.hpp:376
::rclcpp_action::CancelResponse(*)(const uint8_t uuid[16], void *ctx) TypedCancelFnWithCtx
User-facing typed cancel callback signature with user context.
Definition server.hpp:373
::rclcpp::Result set_goal_callback(F f)
Definition server.hpp:388
::rclcpp::Result execute(const ::rclcpp_action::GoalUUID &goal_id)
execute taking a GoalUUID value.
Definition server.hpp:569
::rclcpp::Result set_accepted_callback(F f)
Definition server.hpp:456
::rclcpp::Result publish_feedback(const ::rclcpp_action::GoalUUID &goal_id, const FeedbackType &feedback)
publish_feedback taking a GoalUUID value.
Definition server.hpp:531
::rclcpp_action::GoalResponse(*)(const uint8_t uuid[16], const GoalType &goal) TypedGoalFn
User-facing typed goal callback signature.
Definition server.hpp:365
bool goal_exists(const uint8_t goal_id[16]) const
Definition server.hpp:695
::rclcpp::Result set_cancel_callback_with_ctx(TypedCancelFnWithCtx f, void *ctx)
Definition server.hpp:428
typename A::Goal GoalType
Definition server.hpp:352
::rclcpp_action::CancelResponse(*)(const uint8_t uuid[16]) TypedCancelFn
User-facing typed cancel callback signature.
Definition server.hpp:371
bool is_valid() const
Check if the action server is initialized and valid.
Definition server.hpp:707
::rclcpp_action::ServerGoalHandle< A > GoalHandle
Upstream's rclcpp_action::ServerGoalHandle<A> for this action.
Definition server.hpp:362
::rclcpp::Result complete_goal(const ::rclcpp_action::GoalUUID &goal_id, const ResultType &result)
complete_goal taking a GoalUUID value.
Definition server.hpp:543
typename A::Result ResultType
Definition server.hpp:353
::rclcpp::Result for_each_active_goal(F f)
Definition server.hpp:649
::rclcpp::Result succeed(const uint8_t goal_id[16], const ResultType &result)
Definition server.hpp:589
::rclcpp::Result execute(const uint8_t goal_id[16])
Definition server.hpp:562
Inline storage-size macros for opaque entity buffers.
int nros_cpp_ret_t
Definition future.hpp:25
Definition rclcpp.hpp:437
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:306
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:263
@ Canceled
Definition server.hpp:269
@ Accepted
Definition server.hpp:265
@ Executing
Definition server.hpp:266
@ Succeeded
Definition server.hpp:268
@ Aborted
Definition server.hpp:270
@ Canceling
Definition server.hpp:267
@ Unknown
Definition server.hpp:264
static const size_t ACTION_NAME_MAX
Definition server.hpp:191
Client & operator=(Client &&other)
Definition client.hpp:1000
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:254
@ Ok
Definition server.hpp:255
@ Rejected
Definition server.hpp:256
@ GoalTerminated
Definition server.hpp:258
@ UnknownGoal
Definition server.hpp:257
@ 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:489
detail::Refused< Client > CancelResponse
Definition client.hpp:508
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:1028
static void rehome(Server< A > &s)
Point the bound state at s after a move.
Definition server.hpp:1033
typename A::Goal Goal
Definition server.hpp:1029
ServerGoalHandle< A > Handle
Definition server.hpp:1030