|
nros C API
Lightweight ROS 2 client for embedded real-time systems
|
#include <nros_generated.h>

Data Fields | |
| void * | _handle_entities [NROS_EXECUTOR_MAX_HANDLES] |
| void * | _host |
| uint64_t | _opaque [EXECUTOR_OPAQUE_U64S] |
| size_t | handle_count |
| bool | in_dispatch |
| uint64_t | invocation_time_ns |
| size_t | max_handles |
| enum rclc_executor_semantics_t | semantics |
| size_t | service_count |
| enum rclc_executor_state_t | state |
| size_t | subscription_count |
| const struct rclc_support_t * | support |
| uint64_t | timeout_ns |
| size_t | timer_count |
| rclc_executor_trigger_t | trigger |
| void * | trigger_context |
Executor structure.
The executor delegates all dispatch logic to an internal executor. The C struct retains state, timeout, and per-type counters for API compatibility.
The internal executor is stored inline in _opaque — no heap allocation is needed. The storage size is computed at build time from NROS_EXECUTOR_MAX_CBS and NROS_EXECUTOR_ARENA_SIZE.
| void* rclc_executor_t::_handle_entities[NROS_EXECUTOR_MAX_HANDLES] |
Entity pointer per registered handle slot, indexed by the executor's handle id (phase-417 stage 3).
Written by every ..._add_* that registers a handle, read only when building the [rclc_executor_trigger_handle_t] array a trigger predicate walks. This is the storage that makes rclc_executor_trigger_one's upstream contract — "fire iff `obj` is one
of MY entities and that entity has data" — expressible at all: the readiness array alone carries no entity identity.
NULL means "no entity recorded for this slot".
Placed BEFORE _opaque on purpose. No C code reads it — it is written and read only here, at the Rust layout's offsets — and every field a C caller does read sits above it, so a committed fallback config header that states a different NROS_EXECUTOR_MAX_HANDLES (the NuttX snapshot states the 64-handle ceiling) only changes how much slack the C object carries, exactly like the _opaque bounds.
| void* rclc_executor_t::_host |
phase-492 W4 — NULL for an executor rclc_executor_init built. Non-NULL when a HOST owns the executor (host_executor_init: the C++ binding's context embeds this struct), pointing at the executor in _opaque. rclc_executor_fini then drops nothing; the host does. Internal; no C code reads it.
| uint64_t rclc_executor_t::_opaque[EXECUTOR_OPAQUE_U64S] |
Inline opaque storage for the executor. Managed by rclc_executor_init/fini — no heap allocation needed.
| size_t rclc_executor_t::handle_count |
Number of handles registered
| bool rclc_executor_t::in_dispatch |
Reentrancy guard: set to true while spin_once is dispatching callbacks. Blocking helpers (rclc_client_call, rclc_action_send_goal, etc.) check this flag and return RCLC_RET_REENTRANT if set.
| uint64_t rclc_executor_t::invocation_time_ns |
Next invocation time in nanoseconds for drift-compensated spin_period
| size_t rclc_executor_t::max_handles |
Maximum handles (configured at init)
| enum rclc_executor_semantics_t rclc_executor_t::semantics |
Data communication semantics
| size_t rclc_executor_t::service_count |
Number of service handles
| enum rclc_executor_state_t rclc_executor_t::state |
Current state
| size_t rclc_executor_t::subscription_count |
Number of subscription handles
| const struct rclc_support_t* rclc_executor_t::support |
Pointer to support context
| uint64_t rclc_executor_t::timeout_ns |
Timeout in nanoseconds for spin_some
| size_t rclc_executor_t::timer_count |
Number of timer handles
| rclc_executor_trigger_t rclc_executor_t::trigger |
Trigger function (NULL = default "any" trigger)
| void* rclc_executor_t::trigger_context |
User context for trigger function