12#ifndef NROS_RCLCPP_RCLCPP_HPP
13#define NROS_RCLCPP_RCLCPP_HPP
18#include "rclcpp/detail/nros_cpp_ffi.h"
20#include "rclcpp/detail/traits.hpp"
21#include "rclcpp/logging.hpp"
29#include "rclcpp/duration.hpp"
30#include "rclcpp/time.hpp"
31#include "rclcpp/clock.hpp"
33#include "rclcpp/options.hpp"
45#include "rclcpp/generic.hpp"
50#include "rclcpp/polling_action_server.hpp"
51#include "rclcpp/polling_action_client.hpp"
52#include "rclcpp/polling_client.hpp"
53#include "rclcpp/polling_service.hpp"
54#include "rclcpp/polling_subscription.hpp"
55#include "rclcpp/parameter.hpp"
61#include "rclcpp/node_parameters.hpp"
62#include "rclcpp_lifecycle/lifecycle_node.hpp"
63#include "rclcpp/rosout.hpp"
73#include "rclcpp/detail/component.hpp"
98 if (!::rclcpp::Node::global_initialized()) {
114 nros_cpp_monitors_arm();
140 if (executor ==
nullptr) {
143 nros_cpp_shutdown_callback_handle_t raw = NROS_CPP_SHUTDOWN_CALLBACK_HANDLE_INVALID;
144 nros_cpp_ret_t ret = nros_cpp_add_pre_shutdown_callback(executor, callback, context, &raw);
159 if (executor ==
nullptr) {
162 nros_cpp_shutdown_callback_handle_t raw = NROS_CPP_SHUTDOWN_CALLBACK_HANDLE_INVALID;
163 nros_cpp_ret_t ret = nros_cpp_add_on_shutdown_callback(executor, callback, context, &raw);
172 if (executor ==
nullptr)
return false;
173 return nros_cpp_remove_pre_shutdown_callback(executor,
handle.value()) == 0;
180 if (executor ==
nullptr)
return false;
181 return nros_cpp_remove_on_shutdown_callback(executor,
handle.value()) == 0;
199 explicit Context(
void* executor) : executor_(executor) {}
211 nros_cpp_shutdown_callback_handle_t raw = NROS_CPP_SHUTDOWN_CALLBACK_HANDLE_INVALID;
212 nros_cpp_ret_t ret = nros_cpp_add_pre_shutdown_callback(executor_, callback, context, &raw);
220 nros_cpp_shutdown_callback_handle_t raw = NROS_CPP_SHUTDOWN_CALLBACK_HANDLE_INVALID;
221 nros_cpp_ret_t ret = nros_cpp_add_on_shutdown_callback(executor_, callback, context, &raw);
227 if (executor_ ==
nullptr)
return false;
228 const bool removed = nros_cpp_remove_pre_shutdown_callback(executor_,
handle.value()) == 0;
229#if defined(NROS_CPP_STD)
230 if (removed) release_closure(
handle.value());
236 if (executor_ ==
nullptr)
return false;
237 const bool removed = nros_cpp_remove_on_shutdown_callback(executor_,
handle.value()) == 0;
238#if defined(NROS_CPP_STD)
239 if (removed) release_closure(
handle.value());
244#if defined(NROS_CPP_STD)
247 PreShutdownCallbackHandle add_pre_shutdown_callback(::std::function<void()> callback) {
249 auto* fn = new ::std::function<void()>(
static_cast<::std::function<
void()
>&&>(callback));
254 closures()[h.value()].reset(fn);
260 auto* fn = new ::std::function<void()>(
static_cast<::std::function<
void()
>&&>(callback));
261 if (!add_on_shutdown_callback(&Context::run_closure, fn, &h).
ok()) {
265 closures()[h.value()].reset(fn);
270 static void run_closure(
void* fn) {
271 if (fn !=
nullptr) (*
static_cast<::std::function<
void()
>*>(fn))();
274 ::std::map<nros_cpp_shutdown_callback_handle_t, ::std::unique_ptr<::std::function<void()>>>;
275 static ClosureMap& closures() {
279 static void release_closure(nros_cpp_shutdown_callback_handle_t h) { closures().erase(h); }
299inline bool Clock::sleep_until(Time until, Context context) {
300 if (until.get_clock_type() != get_clock_type())
return false;
301 void* executor = context.executor_handle();
302 if (executor ==
nullptr || !
::rclcpp::ok())
return false;
304 nros_cpp_spin_until_clock(executor, &clock_, until.nanoseconds(), 10);
305 return ret == NROS_CPP_RET_OK && now() >= until;
307inline bool Clock::sleep_until(Time until) {
308 return sleep_until(until, contexts::get_global_default_context());
310inline bool Clock::sleep_for(Duration rel_time, Context context) {
311 return sleep_until(now() + rel_time, context);
313inline bool Clock::sleep_for(Duration rel_time) {
314 return sleep_for(rel_time, contexts::get_global_default_context());
319 return Context(node_ !=
nullptr ? node_->executor_handle() :
nullptr);
332 if (!::rclcpp::Node::global_initialized()) {
338 void* storage = ::rclcpp::Node::global_storage();
340 if (!last.
ok())
return last;
354 if (!::rclcpp::Node::global_initialized()) {
362 return Result(nros_cpp_spin_for(::rclcpp::Node::global_storage(), duration_ms, poll_ms));
401#include <type_traits>
426 return s ==
nullptr ? false
427 :
"--ros-args"[i] ==
'\0' ? s[i] ==
'\0'
428 : s[i] !=
"--ros-args"[i] ? false
433 return i >= argc ? false
434 : argv ==
nullptr ? false
485 RCLC_LOG_ERROR(log_handle(
nullptr),
"rclcpp::Node::%s(\"%.64s\") failed: rclcpp::ErrorCode %d",
486 verb, name !=
nullptr ? name :
"",
static_cast<int>(code));
487 NROS_RCLCPP_SAY_REFUSED(NROS_RCLCPP_ABORT_FAILED_CREATE);
525inline void init(
int argc,
char const*
const* argv) {
560 return ::rclcpp::shutdown_in().ok();
628 const ::rclcpp::QoS& qos) {
646#if defined(NROS_CPP_HAS_STD_STRING)
726 const ::rclcpp::QoS& qos) {
737 return this->
create_publisher<M>(topic.c_str(), ::rclcpp::QoS(
static_cast<uint32_t
>(depth)));
782template <
typename M,
typename Cb>
793template <
typename M,
typename Cb>
795 ::size_t depth, Cb cb) {
838 const ::rclcpp::QoS& qos) {
847template <
typename S,
typename F,
typename>
848inline typename Service<S>::SharedPtr Node::create_service(const ::std::string& name, F callback,
849 const ::rclcpp::QoS& qos) {
850 return this->
template create_service<S>(name.c_str(), callback, qos);
857template <
typename S,
typename F,
typename,
typename>
858inline typename Service<S>::SharedPtr Node::create_service(const ::std::string& name, F callback,
859 const ::rclcpp::QoS& qos) {
862 return this->
template create_service<S>(name.c_str(), callback, qos);
870inline ::rclcpp::Owned<::rclcpp::PollClient<S>> Node::create_client(const ::std::string& name,
871 const ::rclcpp::QoS& qos) {
873 return this->
template create_client<S>(name.c_str(), qos);
880template <
typename S,
typename F,
typename>
882 const ::rclcpp::QoS& qos) {
883 return this->
template create_client<S>(name.c_str(), callback, qos);
890template <
typename S,
typename F,
typename,
typename>
892 const ::rclcpp::QoS&) {
893 static_assert(::rclcpp::detail::refuse<F>::value,
894 NROS_RCLCPP_REFUSE_SHARED_PTR_SERVICE_CALLBACK);
903#if defined(NROS_CPP_HAS_SHARED_PTR)
953template <
typename N, typename ::rclcpp::tr::enable_if<
954 ::rclcpp::tr::is_convertible<N*, ::rclcpp::Node*>::value,
int>::type = 0>
955inline ::rclcpp::Node&
as_node_ref(const ::std::shared_ptr<N>& n) {
998 if (!node || !node->initialized()) {
1011 if (!node || !node->initialized()) {
1019 if (executor ==
nullptr)
return;
1020 (void)nros_cpp_spin_some(executor, 0);
1059 return f.is_ready();
1061#if defined(NROS_CPP_HAS_STD_FUTURE)
1062template <
typename T>
inline bool future_is_ready(const ::std::shared_future<T>& f) {
1063 return f.valid() && f.wait_for(::std::chrono::seconds(0)) == ::std::future_status::ready;
1065template <
typename T>
inline bool future_is_ready(::std::shared_future<T>& f) {
1066 return f.valid() && f.wait_for(::std::chrono::seconds(0)) == ::std::future_status::ready;
1068template <
typename T>
inline bool future_is_ready(::std::future<T>& f) {
1069 return f.valid() && f.wait_for(::std::chrono::seconds(0)) == ::std::future_status::ready;
1074template <
typename Future>
1076 int32_t timeout_ms = -1) {
1077 if (!node || !node->initialized()) {
1081 constexpr int32_t kPollMs = 10;
1082 const bool bounded = timeout_ms >= 0;
1084 const uint64_t budget_ns = bounded ?
static_cast<uint64_t
>(timeout_ms) * 1000000ull : 0ull;
1112template <
typename Future>
1114 int32_t timeout_ms,
bool process) {
1116 constexpr int32_t kPollMs = 10;
1117 const bool bounded = timeout_ms >= 0;
1119 const uint64_t budget_ns = bounded ?
static_cast<uint64_t
>(timeout_ms) * 1000000ull : 0ull;
1120 while (process ?
::rclcpp::ok() : !::nros_cpp_termination_requested()) {
1130template <
typename NodePtr>
1132 const bool live = node && node->initialized();
1133 const char* name = live ? node->get_name() :
"";
1138 if (node->executor_handle() != executor) {
1142 NROS_RCLCPP_SAY_REFUSED(NROS_RCLCPP_REFUSE_FOREIGN_EXECUTOR_NODE);
1144 NROS_RCLCPP_SAY_REFUSED(NROS_RCLCPP_REFUSE_FOREIGN_NODE);
1152template <
typename Future>
1155 return ::rclcpp::detail::spin_executor_until_future_complete(storage_, future, timeout_ms,
1192 void add_node(const ::rclcpp::Node::SharedPtr& node,
bool notify =
true) {
1199 template <
typename NodePtr,
typename T =
void>
1203 static_assert(::rclcpp::detail::refuse<T>::value, NROS_RCLCPP_REFUSE_REMOVE_NODE);
1209 template <
typename Future>
1212 future, timeout_ms,
true);
1218 if (max_duration_ms == 0) {
1219 NROS_RCLCPP_SAY_REFUSED(
"spin_all(0) REFUSED: max_duration must be positive, as in "
1248 if (executor ==
nullptr)
return;
1249 (void)nros_cpp_spin_some(executor, max_ms);
1257 static_assert(::rclcpp::detail::refuse<T>::value,
1258 NROS_RCLCPP_REFUSE_MULTI_THREADED_EXECUTOR);
1276#if defined(NROS_CPP_HAS_SHARED_PTR)
1285template <
typename N, typename ::rclcpp::tr::enable_if<
1286 ::rclcpp::tr::is_convertible<N*, Node*>::value,
int>::type = 0>
1287inline void spin(const ::std::shared_ptr<N>& node) {
1291template <
typename N, typename ::rclcpp::tr::enable_if<
1292 ::rclcpp::tr::is_convertible<N*, Node*>::value,
int>::type = 0>
1293inline void spin_some(const ::std::shared_ptr<N>& node) {
1298 typename N,
typename Future,
1299 typename ::rclcpp::tr::enable_if<::rclcpp::tr::is_convertible<N*, Node*>::value,
int>::type = 0>
1301 Future&& future, int32_t timeout_ms = -1) {
1320template <
typename M,
typename Cb>
1323 Cb cb, ::rclcpp::tr::false_type ) {
1338 NROS_RCLCPP_REFUSE_SUBSCRIPTION_CALLBACK_SHAPE);
1339 using Capture = ::rclcpp::InplaceFn<void(
const M&)>;
1341 ::rclcpp::tr::forward_rvalue(cb)));
1342 ::size_t handle_id = 0;
1344 node, topic, qos, captured, &handle_id);
1348 captured.relinquish();
1357template <
typename M,
typename Cb>
1360 Cb cb, ::rclcpp::tr::true_type ) {
1361#if defined(NROS_CPP_HAS_SHARED_PTR)
1363 auto fn = ::rclcpp::detail::subscription_info_adapter<M, Cb, shape>::wrap(
1364 ::rclcpp::tr::forward_rvalue(cb));
1365 ::size_t handle_id = 0;
1366 const ::rclcpp::Result r = ::rclcpp::detail::register_subscription_message_info<M>(
1367 node, topic, qos,
static_cast<decltype(fn)&&
>(fn), &handle_id);
1371 static_assert(::rclcpp::detail::refuse<Cb>::value, NROS_RCLCPP_REFUSE_MESSAGE_INFO_CALLBACK);
1382inline ::rclcpp::Owned<::rclcpp::GenericPublisher>
1384 const ::rclcpp::QoS& qos) {
1385 ::rclcpp::GenericPublisher p;
1387 this->
ffi_handle(), p, topic, type, type_hash, qos),
1388 "create_generic_publisher", topic);
1389 return ::rclcpp::Owned<::rclcpp::GenericPublisher>(::rclcpp::tr::forward_rvalue(p));
1392template <
typename Cb>
1393inline ::rclcpp::SubscriptionHandle<::rclcpp::GenericSubscription>
1395 const ::rclcpp::QoS& qos, Cb callback) {
1396 ::rclcpp::GenericSubscription::Callback fn(::rclcpp::tr::forward_rvalue(callback));
1397 ::size_t handle_id = 0;
1399 ::rclcpp::detail::register_generic_subscription(this->
ffi_handle(), topic, type, type_hash,
1400 qos, fn, &handle_id),
1401 "create_generic_subscription", topic);
1402 return ::rclcpp::SubscriptionHandle<::rclcpp::GenericSubscription>(this->
executor_handle(),
1406template <
typename M,
typename Cb>
1416 return ::rclcpp::detail::create_subscription_dispatch<M>(
1417 *
this, topic, qos, ::rclcpp::tr::forward_rvalue(cb),
1418 ::rclcpp::tr::integral_constant<bool, takes_info>());
1421template <
typename M,
typename Cb>
1423 ::size_t depth, Cb cb) {
1425 ::rclcpp::tr::forward_rvalue(cb));
1428template <
typename M,
typename Cb>
1431 const ::rclcpp::SubscriptionOptions& options) {
1437 if (options.sched_context != ::rclcpp::SCHED_CONTEXT_UNSET) {
1439 "create_subscription(..., options.sched_context)", topic);
1445 constexpr bool cb_takes_info =
1450 if (options.message_info && !cb_takes_info) {
1453 "create_subscription(..., options.message_info) with a callback taking no "
1454 "rclcpp::MessageInfo",
1460template <
typename M,
typename Cb>
1463 const ::rclcpp::SubscriptionOptions& options) {
1465 ::rclcpp::tr::forward_rvalue(cb), options);
1468template <
typename S>
1470 const ::rclcpp::QoS& qos) {
1478 "create_service", name);
1479 return ::rclcpp::Owned<::rclcpp::PollService<S>>(::rclcpp::tr::forward_rvalue(s));
1482template <
typename S,
typename F,
typename>
1484 const ::rclcpp::QoS& qos) {
1492 "create_service", name);
1496template <
typename S,
typename F,
typename,
typename>
1498 const ::rclcpp::QoS& qos) {
1499#if defined(NROS_CPP_HAS_SHARED_PTR)
1506 constexpr int shape = ::rclcpp::detail::service_ptr_shape<S, F>::value;
1507 constexpr int stateful = ::rclcpp::detail::stateful_service_shape<S, F>::value;
1508 static_assert(shape != 0 || stateful != 0 || ::rclcpp::detail::refuse<F>::value,
1509 NROS_RCLCPP_REFUSE_SERVICE_CALLBACK_SHAPE);
1512 this->
template register_hosted_service_<S>(
1513 s, name, ::rclcpp::tr::forward_rvalue(callback), qos,
1514 ::rclcpp::tr::integral_constant<
int, (shape != 0 ? 0 : 1)>()),
1515 "create_service", name);
1521 static_assert(::rclcpp::detail::refuse<F>::value, NROS_RCLCPP_REFUSE_SERVICE_CALLBACK_SHAPE);
1526#if defined(NROS_CPP_HAS_SHARED_PTR)
1527template <
typename S,
typename F>
1528inline Result Node::register_hosted_service_(
Service<S>& out,
const char* name, F callback,
1529 const ::rclcpp::QoS& qos,
1530 ::rclcpp::tr::integral_constant<int, 0>) {
1531 constexpr int shape = ::rclcpp::detail::service_ptr_shape<S, F>::value;
1532 return this->
template register_service_<S>(
1533 out, name, &::rclcpp::detail::shared_ptr_service_trampoline<S, shape>::call,
1534 ::rclcpp::detail::shared_ptr_service_context<S>(
1535 callback, ::rclcpp::tr::integral_constant<
int, (shape == 3 ? 3 : 2)>()),
1536 qos, ::rclcpp::ServiceOptions());
1539template <
typename S,
typename F>
1540inline Result Node::register_hosted_service_(Service<S>& out,
const char* name, F callback,
1541 const ::rclcpp::QoS& qos,
1542 ::rclcpp::tr::integral_constant<int, 1>) {
1543 constexpr int stateful = ::rclcpp::detail::stateful_service_shape<S, F>::value;
1544 using Fn = ::rclcpp::detail::StatefulServiceFn<S>;
1545 Fn captured(::rclcpp::detail::stateful_service_adapter<S, (stateful != 0 ? stateful : 1)>::wrap(
1546 ::rclcpp::tr::forward_rvalue(callback)));
1547 const Result r = this->
template register_service_<S>(
1548 out, name, &::rclcpp::detail::stateful_service_trampoline<S>::call,
nullptr, qos,
1549 ::rclcpp::ServiceOptions(), &captured,
sizeof(Fn),
1550 &::rclcpp::detail::stateful_service_trampoline<S>::destroy);
1553 captured.relinquish();
1559template <
typename S,
typename F>
1561 const ::rclcpp::QoS& qos,
1562 const ::rclcpp::CallbackGroup* group) {
1564 if (group !=
nullptr && group->get_name() !=
nullptr) {
1566 "create_service(..., named callback group)", name);
1568 return this->
template create_service<S>(name, ::rclcpp::tr::forward_rvalue(callback), qos);
1571template <
typename S>
1573 const ::rclcpp::QoS& qos) {
1581 "create_client", name);
1582 return ::rclcpp::Owned<::rclcpp::PollClient<S>>(::rclcpp::tr::forward_rvalue(c));
1585template <
typename S,
typename F,
typename>
1587 const ::rclcpp::QoS& qos) {
1596 "create_client", name);
1600template <
typename S,
typename F,
typename,
typename>
1602 static_assert(::rclcpp::detail::refuse<F>::value,
1603 NROS_RCLCPP_REFUSE_SHARED_PTR_SERVICE_CALLBACK);
1625 typedef char yes_t[1];
1626 typedef char no_t[2];
1627 template <
typename G>
1628 static yes_t& probe(G* g,
decltype((*g)(*
static_cast<const TimerInfo*
>(
nullptr)), 0));
1629 template <
typename G>
static no_t& probe(...);
1632 static const bool value =
sizeof(probe<F>(
nullptr, 0)) ==
sizeof(yes_t);
1638template <typename F, bool TakesInfo = timer_takes_info<F>::value>
struct TimerAdapter {
1641 const rcl_clock_type_t clock =
static_cast<rcl_clock_type_t
>(raw.clock_type);
1642 const TimerInfo info{Time(raw.expected_call_time, clock),
1643 Time(raw.actual_call_time, clock)};
1658 static constexpr tr::size_type
value = NROS_CPP_CALLBACK_CAPACITY;
1679template <
typename Cb>
1681 Duration period, Cb&& cb,
const char* verb,
1682 const CallbackGroup* group =
nullptr,
1683 bool autostart =
true) {
1684 using F =
typename tr::decay<Cb>::type;
1688 Capture captured(Adapter{tr::relay<Cb>(cb)});
1691 nros_cpp_timer_info_callback_t invoke = [](
const nros_cpp_timer_call_info_t* info,
void* ctx) {
1692 (*
static_cast<Capture*
>(ctx))(*info);
1694 nros_cpp_timer_callback_t destroy = [](
void* ctx) {
static_cast<Capture*
>(ctx)->clear(); };
1695 const int64_t ns = period.nanoseconds();
1696 const uint64_t ms = ns > 0 ?
static_cast<uint64_t
>(ns / 1000000) : uint64_t(0);
1697 size_t handle_id = 0;
1698 const nros_cpp_node_t* h = node.
ffi_handle();
1699 const char* group_name = group !=
nullptr ? group->get_name() :
nullptr;
1701 :
Result(nros_cpp_timer_create_capturing_with_info(
1702 h,
static_cast<uint8_t
>(clock_type), ms, invoke,
1703 reinterpret_cast<const uint8_t*
>(&captured),
sizeof(Capture),
1704 destroy, group_name, autostart, &handle_id));
1706 captured.relinquish();
1720template <
typename Cb>
1722 const ::rclcpp::CallbackGroup* group,
1724 return ::rclcpp::detail::register_timer_capturing(*
this, RCL_STEADY_TIME, period,
1725 ::rclcpp::tr::forward_rvalue(cb),
1726 "create_wall_timer", group, autostart);
1729#ifdef NROS_CPP_HAS_STD_CHRONO
1730template <
typename Rep,
typename Period,
typename Cb>
1732 Cb cb, const ::rclcpp::CallbackGroup* group,
1734 const auto ns = ::std::chrono::duration_cast<::std::chrono::nanoseconds>(period).count();
1735 return this->
create_wall_timer(::rclcpp::Duration::from_nanoseconds(
static_cast<int64_t
>(ns)),
1736 ::rclcpp::tr::forward_rvalue(cb), group, autostart);
1745inline ::rclcpp::Node&
as_node_ref(const ::rclcpp::Node::SharedPtr& n) {
1769template <
typename NodeT,
typename CallbackT>
1770inline ::rclcpp::TimerHandle
1771create_timer(NodeT&& node, ::rclcpp::Clock* clock, ::rclcpp::Duration period, CallbackT&& callback,
1772 const ::rclcpp::CallbackGroup* group =
nullptr,
bool autostart =
true) {
1774 const rcl_clock_type_t type =
1775 clock !=
nullptr ? clock->get_clock_type() : n.
get_clock()->get_clock_type();
1776 return ::rclcpp::detail::register_timer_capturing(n, type, period,
1777 ::rclcpp::tr::relay<CallbackT>(callback),
1778 "create_timer", group, autostart);
1781#ifdef NROS_CPP_HAS_STD_CHRONO
1787template <typename NodeT, typename Rep, typename Period, typename CallbackT>
1788inline ::rclcpp::TimerHandle
1789create_timer(NodeT&& node, ::rclcpp::Clock* clock, ::std::chrono::duration<Rep, Period> period,
1790 CallbackT&& callback, const ::rclcpp::CallbackGroup* group =
nullptr,
1791 bool autostart =
true) {
1792 const auto ns = ::std::chrono::duration_cast<::std::chrono::nanoseconds>(period).count();
1793 return create_timer(::rclcpp::tr::relay<NodeT>(node), clock,
1794 ::rclcpp::Duration::from_nanoseconds(
static_cast<int64_t
>(ns)),
1795 ::rclcpp::tr::relay<CallbackT>(callback), group, autostart);
1856 return default_value;
1858 const ::nros_cpp_node_t* h = this->
ffi_handle();
1859 Result r = ::rclcpp::detail::node_param_declare(h, name, default_value);
1860 if (!r.
ok() && r.
raw() != RCLC_RET_ALREADY_EXISTS) {
1861 return default_value;
1864 if (!::rclcpp::detail::node_param_get(h, name, out).
ok()) {
1865 return default_value;
1875 return ::rclcpp::detail::node_param_get(this->
ffi_handle(), name, out).ok();
1884 (void)::rclcpp::detail::node_param_get(this->
ffi_handle(), name, out);
1899 return ::rclcpp::detail::node_param_set(this->
ffi_handle(), name, value);
1907 return ::rclcpp::detail::node_param_has(this->
ffi_handle(), name);
1919template <
typename T>
1921 const ParameterDescriptor& descriptor) {
1929 (void)::rclcpp::detail::node_param_apply_descriptor(
1930 this->
ffi_handle(), name, descriptor, ::rclcpp::detail::node_param_type<T>::value);
1934template <
typename T>
1936 if (::rclcpp::detail::node_param_get(this->
ffi_handle(), name, out).
ok()) {
1944 return ::rclcpp::detail::node_param_undeclare(this->
ffi_handle(), name);
1949 if (!::rclcpp::detail::node_param_get_type(this->
ffi_handle(), name, code).
ok()) {
1950 return PARAMETER_NOT_SET;
1952 return static_cast<ParameterType
>(code);
1956 ParameterType* out)
const {
1957 if ((names ==
nullptr || out ==
nullptr) && count != 0) {
1958 return Result(RCL_RET_INVALID_ARGUMENT);
1960 for (::size_t i = 0; i < count; ++i) {
1963 return Result(RCL_RET_OK);
1967 ::size_t text_len)
const {
1968 out = parameter_descriptor();
1971 char* description =
nullptr;
1972 char* constraints =
nullptr;
1974 if (text !=
nullptr && text_len >= 2) {
1975 half = text_len / 2;
1977 constraints = text + half;
1980 Result r = ::rclcpp::detail::node_param_describe(this->
ffi_handle(), name, description, half,
1981 constraints, half, &out.read_only, &type);
1982 if (r.
raw() == RCLC_RET_NOT_FOUND) {
1985 out.description = description;
1986 out.additional_constraints = constraints;
1990 if (type == ::rclcpp::param_type::INTEGER) {
1992 ::rclcpp::detail::node_param_get_range(this->
ffi_handle(), name, &out.integer_from,
1993 &out.integer_to, &out.integer_step)
1995 }
else if (type == ::rclcpp::param_type::DOUBLE) {
1997 ::rclcpp::detail::node_param_get_range(this->
ffi_handle(), name, &out.double_from,
1998 &out.double_to, &out.double_step)
2005 ::size_t max_names, ::size_t& count)
const {
2006 return ::rclcpp::detail::node_param_list(this->
ffi_handle(), prefix, out_names, name_stride,
2011 return ::rclcpp::detail::node_params_set_atomically(this->
ffi_handle(), writes, count);
2016 OnSetParametersCallbackToken& out_handle) {
2017 return ::rclcpp::detail::node_param_add_on_set_callback(this->
ffi_handle(), callback, context,
2022 return ::rclcpp::detail::node_param_remove_on_set_callback(this->
ffi_handle(), handle);
2036template <
typename T>
2037inline T node_declare_typed(Node& n,
const char* name, T v,
const ParameterDescriptor* d) {
2038 return d !=
nullptr ? n.template declare_parameter<T>(name, v, *d)
2039 : n.template declare_parameter<T>(name, v);
2042inline ParameterValue node_declare_value(Node& n,
const char* name,
const ParameterValue& v,
2043 const ParameterDescriptor* d) {
2044 switch (v.get_type()) {
2045 case PARAMETER_BOOL:
2046 return ParameterValue(node_declare_typed<bool>(n, name, v.as_bool(), d));
2047 case PARAMETER_INTEGER:
2048 return ParameterValue(
2049 static_cast<long long>(node_declare_typed<int64_t>(n, name, v.as_int(), d)));
2050 case PARAMETER_DOUBLE:
2051 return ParameterValue(node_declare_typed<double>(n, name, v.as_double(), d));
2052 case PARAMETER_STRING:
2053 return ParameterValue(node_declare_typed<::std::string>(n, name, v.as_string(), d));
2054 case PARAMETER_BOOL_ARRAY:
2055 return ParameterValue(
2056 node_declare_typed<::std::vector<bool>>(n, name, v.as_bool_array(), d));
2057 case PARAMETER_INTEGER_ARRAY:
2058 return ParameterValue(
2059 node_declare_typed<::std::vector<int64_t>>(n, name, v.as_integer_array(), d));
2060 case PARAMETER_DOUBLE_ARRAY:
2061 return ParameterValue(
2062 node_declare_typed<::std::vector<double>>(n, name, v.as_double_array(), d));
2065 return ParameterValue();
2072template <
typename D>
inline ParameterDescriptor descriptor_from_message(
const D& m) {
2073 ParameterDescriptor d = ::rclcpp::parameter_descriptor();
2074 d.description = m.description.c_str();
2075 d.additional_constraints = m.additional_constraints.c_str();
2076 d.read_only = m.read_only;
2077 for (
const auto& r : m.floating_point_range) {
2079 d.double_from = r.from_value;
2080 d.double_to = r.to_value;
2081 d.double_step = r.step;
2084 for (
const auto& r : m.integer_range) {
2086 d.integer_from = r.from_value;
2087 d.integer_to = r.to_value;
2088 d.integer_step =
static_cast<int64_t
>(r.step);
2094inline Node::SetParametersOutcome node_set_outcome(Result r) {
2095 Node::SetParametersOutcome o;
2096 o.successful = r.ok();
2097 if (!o.successful) {
2098 o.reason =
"set_parameter refused (nano-ros code " + ::std::to_string(r.raw()) +
")";
2105inline ParameterValue Node::declare_parameter(
const char* name,
2106 const ParameterValue& default_value) {
2107 return ::rclcpp::detail::node_declare_value(*
this, name, default_value,
nullptr);
2110inline ParameterValue Node::declare_parameter(
const char* name,
const ParameterValue& default_value,
2111 const ParameterDescriptor& descriptor) {
2112 return ::rclcpp::detail::node_declare_value(*
this, name, default_value, &descriptor);
2115template <
typename D,
typename>
2116inline ParameterValue Node::declare_parameter(
const char* name,
const ParameterValue& default_value,
2117 const D& descriptor) {
2118 const ParameterDescriptor d = ::rclcpp::detail::descriptor_from_message(descriptor);
2119 return ::rclcpp::detail::node_declare_value(*
this, name, default_value, &d);
2122template <
typename T,
typename D,
typename>
2123inline T Node::declare_parameter(
const char* name, T default_value,
const D& descriptor) {
2124 const ParameterDescriptor d = ::rclcpp::detail::descriptor_from_message(descriptor);
2125 return this->
template declare_parameter<T>(name, default_value, d);
2128inline bool Node::get_parameter(
const char* name, Parameter& out)
const {
2130 switch (this->get_parameter_type(name)) {
2131 case PARAMETER_BOOL: {
2133 if (!this->
template get_parameter<bool>(name, x))
return false;
2134 v = ParameterValue(x);
2137 case PARAMETER_INTEGER: {
2139 if (!this->
template get_parameter<int64_t>(name, x))
return false;
2140 v = ParameterValue(
static_cast<long long>(x));
2143 case PARAMETER_DOUBLE: {
2145 if (!this->
template get_parameter<double>(name, x))
return false;
2146 v = ParameterValue(x);
2149 case PARAMETER_STRING: {
2151 if (!this->
template get_parameter<::std::string>(name, x))
return false;
2152 v = ParameterValue(x);
2155 case PARAMETER_BOOL_ARRAY: {
2156 ::std::vector<bool> x;
2157 if (!this->
template get_parameter<::std::vector<bool>>(name, x))
return false;
2158 v = ParameterValue(x);
2161 case PARAMETER_INTEGER_ARRAY: {
2162 ::std::vector<int64_t> x;
2163 if (!this->
template get_parameter<::std::vector<int64_t>>(name, x))
return false;
2164 v = ParameterValue(x);
2167 case PARAMETER_DOUBLE_ARRAY: {
2168 ::std::vector<double> x;
2169 if (!this->
template get_parameter<::std::vector<double>>(name, x))
return false;
2170 v = ParameterValue(x);
2176 out = Parameter(::std::string(name), v);
2180inline Parameter Node::get_parameter(const ::std::string& name)
const {
2182 (void)this->get_parameter(name.c_str(), p);
2186inline ::std::vector<Parameter>
2187Node::get_parameters(const ::std::vector<::std::string>& names)
const {
2188 ::std::vector<Parameter> out;
2189 out.reserve(names.size());
2190 for (
const auto& n : names) {
2191 out.push_back(this->get_parameter(n));
2196inline Node::SetParametersOutcome Node::set_parameter(
const Parameter& p) {
2197 const char* name = p.get_name().c_str();
2198 Result r(NROS_CPP_RET_UNSUPPORTED);
2199 switch (p.get_type()) {
2200 case PARAMETER_BOOL:
2201 r = this->
template set_parameter<bool>(name, p.as_bool());
2203 case PARAMETER_INTEGER:
2204 r = this->
template set_parameter<int64_t>(name, p.as_int());
2206 case PARAMETER_DOUBLE:
2207 r = this->
template set_parameter<double>(name, p.as_double());
2209 case PARAMETER_STRING:
2210 r = this->
template set_parameter<::std::string>(name, p.as_string());
2212 case PARAMETER_BOOL_ARRAY:
2213 r = this->
template set_parameter<::std::vector<bool>>(name, p.as_bool_array());
2215 case PARAMETER_INTEGER_ARRAY:
2216 r = this->
template set_parameter<::std::vector<int64_t>>(name, p.as_integer_array());
2218 case PARAMETER_DOUBLE_ARRAY:
2219 r = this->
template set_parameter<::std::vector<double>>(name, p.as_double_array());
2224 return ::rclcpp::detail::node_set_outcome(r);
2227inline ::std::vector<Node::SetParametersOutcome>
2228Node::set_parameters(const ::std::vector<Parameter>& parameters) {
2229 ::std::vector<SetParametersOutcome> out;
2230 out.reserve(parameters.size());
2231 for (
const auto& p : parameters) {
2232 out.push_back(this->set_parameter(p));
2237template <
typename F>
2238inline node_interfaces::OnSetParametersCallbackHandle::SharedPtr
2239Node::add_on_set_parameters_callback(F callback) {
2240 using Handle = node_interfaces::OnSetParametersCallbackHandle;
2241 auto handle = ::std::make_shared<Handle>();
2242 handle->callback = [callback](const ::std::vector<Parameter>& params)
mutable ->
bool {
2243 return static_cast<bool>(callback(params).successful);
2245 handle->node = this->ffi_handle();
2246 Result r = ::rclcpp::detail::node_param_add_on_set_callback(
handle->node, &Handle::trampoline,
2251 handle->registered =
true;
2255inline void Node::remove_on_set_parameters_callback(
2256 const node_interfaces::OnSetParametersCallbackHandle*
handle) {
2258 const_cast<node_interfaces::OnSetParametersCallbackHandle*
>(
handle)->unregister();
2262namespace node_interfaces {
2263inline bool NodeParametersInterface::has_parameter(const ::std::string& name)
const {
2264 return node_ !=
nullptr && node_->has_parameter(name);
2266inline ParameterValue NodeParametersInterface::declare_parameter(const ::std::string& name,
2267 const ParameterValue& v) {
2268 return node_ ==
nullptr ? ParameterValue() : node_->declare_parameter(name, v);
2270template <
typename D>
2271inline ParameterValue NodeParametersInterface::declare_parameter(const ::std::string& name,
2272 const ParameterValue& v,
2273 const D& descriptor) {
2274 return node_ ==
nullptr ? ParameterValue() : node_->declare_parameter(name, v, descriptor);
2276inline bool NodeParametersInterface::get_parameter(const ::std::string& name,
2277 Parameter& out)
const {
2278 return node_ !=
nullptr && node_->get_parameter(name, out);
2280inline Parameter NodeParametersInterface::get_parameter(const ::std::string& name)
const {
2281 return node_ ==
nullptr ? Parameter(name) : node_->get_parameter(name);
2283inline const ::std::map<::std::string, ParameterValue>&
2284NodeParametersInterface::get_parameter_overrides()
const {
2285 using Map = ::std::map<::std::string, ParameterValue>;
2289 static ::std::map<const void*, Map> copies;
2291 if (node_ ==
nullptr || node_->ffi_handle() ==
nullptr) {
2295 static bool add(
const ParameterWrite* write,
void* context) {
2296 if (write !=
nullptr && write->name !=
nullptr) {
2297 (*
static_cast<Map*
>(context))[write->name] =
2298 Parameter::from_write(*write).get_parameter_value();
2304 (void)::rclcpp::detail::node_param_list_overrides(node_->ffi_handle(), &Sink::add, &now,
2306 Map& kept = copies[node_->ffi_handle()];
2308 kept =
static_cast<Map&&
>(now);
2385 : period_ns_(frequency_hz > 0.0 ? static_cast<int64_t>(1000000000.0 / frequency_hz) : 0) {
2392 if (period_ns_ < 0) period_ns_ = 0;
2396#ifdef NROS_CPP_HAS_STD_CHRONO
2402 template <typename Rep, typename Period>
2403 explicit Rate(std::chrono::duration<Rep, Period>
period)
2404 : period_ns_(std::chrono::duration_cast<std::chrono::nanoseconds>(
period).count()) {
2405 if (period_ns_ < 0) period_ns_ = 0;
2416 if (period_ns_ <= 0) {
2420 if (now_ns >= next_tick_ns_) {
2426 next_tick_ns_ = now_ns +
static_cast<uint64_t
>(period_ns_);
2429 const uint64_t remaining_ns = next_tick_ns_ - now_ns;
2432 uint32_t remaining_ms =
static_cast<uint32_t
>((remaining_ns + 999999ull) / 1000000ull);
2433 if (remaining_ms == 0) remaining_ms = 1;
2434 next_tick_ns_ +=
static_cast<uint64_t
>(period_ns_);
2435 const int32_t poll_ms = remaining_ms < 10u ? static_cast<int32_t>(remaining_ms) : 10;
2449 ::rclcpp::Duration
period()
const { return ::rclcpp::Duration::from_nanoseconds(period_ns_); }
2453 uint64_t next_tick_ns_;
2467#include "rclcpp_action/create_client.hpp"
2468#include "rclcpp_action/create_server.hpp"
2471#include "rclcpp/parameter_event_handler.hpp"
::rclcpp::ClientHandle< S > SharedPtr
Definition client.hpp:142
Definition rclcpp.hpp:195
Context()
Definition rclcpp.hpp:198
Context(void *executor)
Definition rclcpp.hpp:199
Context SharedPtr
Definition rclcpp.hpp:197
Result add_pre_shutdown_callback(ShutdownCallback callback, void *context, PreShutdownCallbackHandle *out=nullptr)
The C-callback forms, on every target. See rclcpp::pre_shutdown.
Definition rclcpp.hpp:208
bool remove_pre_shutdown_callback(const PreShutdownCallbackHandle &handle)
true when handle named a live callback.
Definition rclcpp.hpp:226
Context * operator->()
Definition rclcpp.hpp:200
void * executor_handle() const
The executor handle this context names; null for an empty one.
Definition rclcpp.hpp:203
const Context * operator->() const
Definition rclcpp.hpp:201
bool remove_on_shutdown_callback(const OnShutdownCallbackHandle &handle)
Definition rclcpp.hpp:235
bool is_valid() const
Context::is_valid() — named, and not yet shut down.
Definition rclcpp.hpp:205
Result add_on_shutdown_callback(ShutdownCallback callback, void *context, OnShutdownCallbackHandle *out=nullptr)
Definition rclcpp.hpp:217
void add_node(const NodePtr &node, bool notify=true)
Definition rclcpp.hpp:1159
FutureReturnCode spin_until_future_complete(Future &&future, int32_t timeout_ms=-1)
Definition rclcpp.hpp:1153
Definition future.hpp:337
const nros_cpp_node_t * ffi_handle() const
Definition node.hpp:1887
Result get_parameter_types(const char *const *names, ::size_t count, ParameterType *out) const
Definition rclcpp.hpp:1955
Result add_on_set_parameters_callback(OnSetParametersCallbackType callback, void *context, OnSetParametersCallbackToken &out_handle)
Definition rclcpp.hpp:2014
::rclcpp::Owned<::rclcpp::PollService< S > > create_service(const char *name, const ::rclcpp::QoS &qos=::rclcpp::QoS::services())
bool get_parameter(const char *name, T &out) const
Definition rclcpp.hpp:1874
typename::rclcpp::Subscription< M >::SharedPtr create_subscription(const char *topic, const ::rclcpp::QoS &qos, Cb cb)
typename::rclcpp::Publisher< M >::SharedPtr create_publisher(const char *topic, const ::rclcpp::QoS &qos=::rclcpp::QoS::default_profile())
create_publisher<M>(topic, qos) — available on every target.
::rclcpp::TimerHandle create_wall_timer(::rclcpp::Duration period, Cb cb, const ::rclcpp::CallbackGroup *group=nullptr, bool autostart=true)
bool check_declared_param(const char *name, int passed_type)
Definition node.hpp:2879
Result describe_parameter(const char *name, ParameterDescriptor &out, char *text, ::size_t text_len) const
Definition rclcpp.hpp:1966
T declare_parameter(const char *name, T default_value=T())
rclcpp::Node::declare_parameter<T>(name, default).
Definition rclcpp.hpp:1851
Result remove_on_set_parameters_callback(OnSetParametersCallbackToken handle)
rclcpp::Node::remove_on_set_parameters_callback(handle).
Definition rclcpp.hpp:2021
bool get_parameter_or(const char *name, T &out, T fallback) const
Definition rclcpp.hpp:1935
ParameterType get_parameter_type(const char *name) const
Definition rclcpp.hpp:1947
bool ok() const
Definition node.hpp:969
bool has_parameter(const char *name) const
rclcpp::Node::has_parameter(name).
Definition rclcpp.hpp:1906
void * executor_handle() const
Definition node.hpp:1911
Result list_parameters(const char *prefix, char *out_names, ::size_t name_stride, ::size_t max_names, ::size_t &count) const
Definition rclcpp.hpp:2004
::rclcpp::Handle< Node > SharedPtr
Definition node.hpp:1051
Result set_parameters_atomically(const ParameterWrite *writes, ::size_t count)
Definition rclcpp.hpp:2010
::rclcpp::Owned<::rclcpp::PollClient< S > > create_client(const char *name, const ::rclcpp::QoS &qos=::rclcpp::QoS::services())
::rclcpp::SubscriptionHandle<::rclcpp::GenericSubscription > create_generic_subscription(const char *topic, const char *type, const char *type_hash, const ::rclcpp::QoS &qos, Cb callback)
Result set_parameter(const char *name, T value)
Definition rclcpp.hpp:1898
Clock * get_clock()
Definition node.hpp:1859
Result undeclare_parameter(const char *name)
Definition rclcpp.hpp:1943
::rclcpp::Owned<::rclcpp::GenericPublisher > create_generic_publisher(const char *topic, const char *type, const char *type_hash, const ::rclcpp::QoS &qos=::rclcpp::QoS::default_profile())
Definition rclcpp.hpp:1383
Definition executor.hpp:91
Definition executor.hpp:84
Definition publisher.hpp:178
::rclcpp::Owned< Publisher< M > > SharedPtr
Definition publisher.hpp:202
Definition rclcpp.hpp:2380
bool sleep()
Definition rclcpp.hpp:2415
Rate(::rclcpp::Duration period)
Definition rclcpp.hpp:2391
Rate(double frequency_hz)
Definition rclcpp.hpp:2384
void reset()
rclcpp::Rate::reset() — anchor the next tick one period from now.
Definition rclcpp.hpp:2441
::rclcpp::Duration period() const
Definition rclcpp.hpp:2449
int32_t raw() const
Get the raw integer code (for FFI interop).
Definition result.hpp:236
bool ok() const
Returns true if the operation succeeded.
Definition result.hpp:227
static constexpr ResultOf success()
Named constructors.
Definition result.hpp:239
Definition service.hpp:146
size_t handle_id() const
Executor arena slot for the registration; SIZE_MAX until registered.
Definition service.hpp:282
::rclcpp::ServiceHandle< S > SharedPtr
Definition service.hpp:158
::rclcpp::SubscriptionHandle< M > SharedPtr
Definition subscription.hpp:220
Definition rclcpp.hpp:1624
static const bool value
Definition rclcpp.hpp:1632
The refusal behind MultiThreadedExecutor; see that alias.
Definition rclcpp.hpp:1254
MultiThreadedExecutorRefused(Args &&...)
Definition rclcpp.hpp:1256
void spin_some(uint32_t max_ms=0)
Definition rclcpp.hpp:1246
void spin()
Block until rclcpp::ok() goes false — rclcpp::spin_in().
Definition rclcpp.hpp:1242
void remove_node(const NodePtr &node, bool notify=true)
Definition rclcpp.hpp:1200
FutureReturnCode spin_until_future_complete(Future &&future, int32_t timeout_ms=-1)
Definition rclcpp.hpp:1210
SingleThreadedExecutor()
Definition rclcpp.hpp:1188
void spin_node_once(const ::rclcpp::Node::SharedPtr &node, int32_t timeout_ms)
Definition rclcpp.hpp:1236
void spin_all(uint32_t max_duration_ms)
Definition rclcpp.hpp:1217
void add_node(const ::rclcpp::Node::SharedPtr &node, bool notify=true)
Definition rclcpp.hpp:1192
void spin_node_some(const ::rclcpp::Node::SharedPtr &node)
Definition rclcpp.hpp:1228
Node * node() const
The node this handle names (null for a default-constructed one).
Definition node.hpp:247
Context get_context() const
Definition rclcpp.hpp:318
rclcpp::Future<T> — single-shot deferred result.
int nros_cpp_ret_t
Definition future.hpp:25
nros_cpp_ret_t nros_cpp_spin_once(void *handle, int32_t timeout_ms)
uint64_t nros_cpp_time_ns(void)
Definition rclcpp.hpp:286
Context get_global_default_context()
Definition rclcpp.hpp:289
Definition rclcpp.hpp:418
void check_node_on_executor(const NodePtr &node, void *executor, bool process)
phase-515 P2 — the add_node check, against one executor handle.
Definition rclcpp.hpp:1131
Subscription< M >::SharedPtr create_subscription_dispatch(::rclcpp::Node &node, const char *topic, const ::rclcpp::QoS &qos, Cb cb, ::rclcpp::tr::false_type)
The one-argument callback path (void(const M&), or a hosted pointer shape).
Definition rclcpp.hpp:1322
void abort_failed_create(const char *verb, const char *name, int32_t code)
Definition rclcpp.hpp:478
@ SUB_SHAPE_NONE
Definition subscription.hpp:719
void require_created(::rclcpp::Result r, const char *verb, const char *name)
Definition rclcpp.hpp:493
TimerHandle register_timer_capturing(::rclcpp::Node &node, rcl_clock_type_t clock_type, Duration period, Cb &&cb, const char *verb, const CallbackGroup *group=nullptr, bool autostart=true)
Definition rclcpp.hpp:1680
constexpr bool is_ros_args_flag(char const *s, int i=0)
Definition rclcpp.hpp:425
int32_t apply_ros_args(void *executor, int argc, char const *const *argv)
Definition node.hpp:3495
inline ::rclcpp::Node & as_node_ref(const ::rclcpp::Node::SharedPtr &n)
Definition rclcpp.hpp:1745
Result register_subscription_capturing(::rclcpp::Node &node, const char *topic, const QoS &qos, const Fn &fn, size_t *out_handle_id)
Definition subscription.hpp:928
FutureReturnCode spin_executor_until_future_complete(void *executor, Future &future, int32_t timeout_ms, bool process)
Definition rclcpp.hpp:1113
bool future_is_ready(F &f)
Definition rclcpp.hpp:1058
constexpr bool argv_has_ros_args(int argc, char const *const *argv, int i=0)
Definition rclcpp.hpp:432
Definition rclcpp.hpp:1165
MultiThreadedExecutorRefused<> MultiThreadedExecutor
Definition rclcpp.hpp:1270
Definition rclcpp.hpp:317
NodeInterfaceHandle< 0 > NodeBaseInterface
Definition node.hpp:261
Rate WallRate
Definition rclcpp.hpp:2458
void(*)(void *context) ShutdownCallback
Definition executor.hpp:47
void spin(const Node::SharedPtr &node)
Definition rclcpp.hpp:997
void spin_some(const Node::SharedPtr &node)
Definition rclcpp.hpp:1010
inline ::rclcpp::TimerHandle create_timer(NodeT &&node, ::rclcpp::Clock *clock, ::rclcpp::Duration period, CallbackT &&callback, const ::rclcpp::CallbackGroup *group=nullptr, bool autostart=true)
Definition rclcpp.hpp:1771
Result init_in(const char *locator=nullptr, uint8_t domain_id=0)
Definition node.hpp:3316
Result spin_once(int32_t timeout_ms=10)
Definition rclcpp.hpp:97
FutureReturnCode
Definition rclcpp.hpp:589
@ TIMEOUT
The deadline passed with the future still pending.
Definition rclcpp.hpp:592
@ INTERRUPTED
rclcpp::ok() went false (shutdown) before the future was ready.
Definition rclcpp.hpp:594
@ SUCCESS
Definition rclcpp.hpp:590
void init()
rclcpp::init() — the zero-argument form. ADOPT.
Definition rclcpp.hpp:542
FutureReturnCode spin_until_future_complete(const Node::SharedPtr &node, Future &&future, int32_t timeout_ms=-1)
Definition rclcpp.hpp:1075
bool remove_on_shutdown_callback(OnShutdownCallbackHandle handle)
Definition rclcpp.hpp:178
bool ok()
Definition node.hpp:3564
Result spin_in()
Definition rclcpp.hpp:331
void * global_handle()
Definition node.hpp:3485
Result on_shutdown(ShutdownCallback callback, void *context=nullptr, OnShutdownCallbackHandle *out=nullptr)
Definition rclcpp.hpp:156
bool shutdown()
Definition rclcpp.hpp:559
bool remove_pre_shutdown_callback(PreShutdownCallbackHandle handle)
Definition rclcpp.hpp:170
void arm_monitors()
Definition rclcpp.hpp:113
@ NotInitialized
Definition result.hpp:131
@ Unsupported
Operation not implemented by the active backend.
Definition result.hpp:152
Result pre_shutdown(ShutdownCallback callback, void *context=nullptr, PreShutdownCallbackHandle *out=nullptr)
Definition rclcpp.hpp:137
ResultOf< void > Result
Definition result.hpp:247
rclcpp::Node and global session helpers.
rclcpp::Publisher<M> — typed topic publisher.
rclcpp::QoS — full DDS-shaped QoS settings (Phase 108.B.7).
rclcpp::Client<S> — the arena-registered (callback-style) service client, and Client<S>::SharedPtr = ...
**auto handle
Definition client.hpp:127
rclcpp::Result, rclcpp::ErrorCode, and the RCLCPP_TRY macro.
rclcpp::Service<S> — the arena-registered (callback-style) service server, and Service<S>::SharedPtr ...
rclcpp::Stream<T> — multi-shot message receiver.
void operator()(const nros_cpp_timer_call_info_t &)
Definition rclcpp.hpp:1649
F f
Definition rclcpp.hpp:1648
Definition rclcpp.hpp:1638
F f
Definition rclcpp.hpp:1639
void operator()(const nros_cpp_timer_call_info_t &raw)
Definition rclcpp.hpp:1640
Definition subscription.hpp:767
Which SubscriptionCallbackShape the callable F is, for message M.
Definition subscription.hpp:761
Definition subscription.hpp:855
static constexpr tr::size_type value
Definition rclcpp.hpp:1661
Definition rclcpp.hpp:1657
static constexpr tr::size_type value
Definition rclcpp.hpp:1658
rclcpp::Subscription<M> — the typed DISPATCH subscriber: the arena owns it and the executor calls you...