Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Environment Variables Reference

Configuration File

All environment variables can be set in a .env file at the project root:

cp .env.example .env
# Edit .env — uncomment and adjust values as needed
  • justfile.env is auto-loaded. Missing file silently ignored.
  • direnv.envrc sources .env if present.
  • Manualset -a; source .env; set +a before cargo build.

Variables in .env take precedence over justfile defaults but are overridden by explicit shell exports.

Runtime Configuration

Examples use ExecutorConfig::from_env() for configuration:

VariableDescriptionDefault
ROS_DOMAIN_IDROS 2 domain ID0
NROS_LOCATORRMW locator (tcp/…, udp/…, serial/…, or tls/…)tcp/127.0.0.1:7447
NROS_SESSION_MODESession mode: client or peerclient
ZENOH_TLS_ROOT_CA_CERTIFICATEPath to CA certificate (PEM) for TLS(none)
ZENOH_TLS_ROOT_CA_CERTIFICATE_BASE64Base64-encoded CA certificate for TLS(none)
ZENOH_TLS_VERIFY_NAME_ON_CONNECTVerify server hostname in TLS (true/false)(none)

Deprecated legacy names: ZENOH_LOCATOR and ZENOH_MODE are still accepted (they fall back to NROS_LOCATOR / NROS_SESSION_MODE) but will print a one-line deprecation warning to stderr. Migrate to the NROS_* names. ZENOH_TLS_* names are kept because TLS is currently zenoh-specific.

TLS Notes

  • POSIX: requires libmbedtls-dev (just setup base checks it). File-path and base64 cert loading are both supported.
  • Bare-metal: only ZENOH_TLS_ROOT_CA_CERTIFICATE_BASE64 is supported (no filesystem). The certificate is embedded at build time.
  • The link-tls Cargo feature must be enabled on both the example and the nros crate.

Build-Time Configuration

VariableDescriptionRequired
ZENOH_PICO_DIRCMake install prefix for pre-built zenoh-pico (use with system-zenohpico feature on zpico-sys)Only with system-zenohpico
SSIDWiFi network name for ESP32 examplesRequired for build-examples-esp32
PASSWORDWiFi password for ESP32 examplesRequired for build-examples-esp32
NROS_EXTRA_BOARD_PATHExtra board-search roots (PATH-style : separated). Each entry is a directory shaped like packages/boards/ — subdirs carrying nros-board.toml crates or */boards/<name>/board.cmake bundles. Read by the nros CLI’s board catalog AND nano_ros_use_board() (also settable as a CMake cache var there). Board keys stay global: a name found under two roots is an error, never shadowed.(unset)

ARM FVP (FVP_BaseR_AEMv8R)

License-gated — nano-ros does not download the binary. Set one of the discovery vars after accepting the Arm EULA and installing locally. See the ARM FVP getting-started chapter for the end-to-end build+run walk-through.

VariableDescriptionDefault
ARMFVP_BIN_PATHDirectory containing FVP_BaseR_AEMv8R (Zephyr-canonical, highest priority).(unset)
ARM_FVP_DIRInstall root; resolver scans models/Linux64_GCC-*/ underneath. Matches sdk-index.(unset)

If neither is set, scripts/zephyr/resolve-fvp-bin.sh falls back to dirname $(command -v FVP_BaseR_AEMv8R). Phase 217.A — just zephyr run-fvp-ws-entry / run-fvp-board-import skip gracefully when the binary can’t be resolved.

After extracting the Arm-provided tarball, run scripts/installers/arm-fvp-installer.sh with ARM_FVP_DIR set to the extraction root — it locates FVP_BaseR_AEMv8R, symlinks the directory to ~/.nros/sdks/arm-fvp/current/, and prints the export ARMFVP_BIN_PATH=… line for your shell rc. Verify with nros doctor --board fvp-aemv8r-smp, which cross-checks the [gated.arm-fvp] entry in nros-sdk-index.toml and warns (never hard-fails — license-gated) when the binary is missing.

FreeRTOS / NuttX / ThreadX SDK Paths

These are auto-resolved by justfile recipes (defaulting to external/ paths from just setup freertos / just setup nuttx / just setup threadx_linux). Override via env vars if sources are elsewhere.

VariableDefaultDescription
FREERTOS_DIRthird-party/freertos/kernelFreeRTOS kernel source
FREERTOS_PORTGCC/ARM_CM3FreeRTOS portable layer
LWIP_DIRthird-party/freertos/lwiplwIP source
FREERTOS_CONFIG_DIRBoard crate’s config/FreeRTOSConfig.h + lwipopts.h
NUTTX_DIRthird-party/nuttx/nuttxNuttX RTOS source
NUTTX_APPS_DIRthird-party/nuttx/nuttx-appsNuttX apps source
THREADX_DIRthird-party/threadx/kernelThreadX kernel source
THREADX_CONFIG_DIRBoard crate’s config/ThreadX config (tx_user.h)
NETX_DIRthird-party/threadx/netxduoNetX Duo source
NETX_CONFIG_DIRBoard crate’s config/NetX Duo config (nx_user.h)

Buffer Tuning

All optional – platform-appropriate defaults apply if unset. See Configuration for deployment-scenario guidance and platform guides for target-specific sizing.

Zenoh-pico (ZPICO_*)

VariableDescriptionDefaultCrate
ZPICO_FRAG_MAX_SIZEMax reassembled message size after defragmentation65536 / 2048zpico-sys
ZPICO_BATCH_UNICAST_SIZEMax unicast batch size before fragmentation65536 / 1024zpico-sys
ZPICO_BATCH_MULTICAST_SIZEMax multicast batch size8192 / 1024zpico-sys
ZPICO_MAX_PUBLISHERSMax concurrent publishers in zenoh shim8zpico-sys
ZPICO_MAX_SUBSCRIBERSMax concurrent subscribers in zenoh shim8zpico-sys
ZPICO_MAX_QUERYABLESMax concurrent queryables in zenoh shim8zpico-sys
ZPICO_MAX_LIVELINESSMax concurrent liveliness tokens in zenoh shim16zpico-sys
ZPICO_MAX_PENDING_GETSMax concurrent in-flight service calls4zpico-sys
ZPICO_SUBSCRIBER_BUFFER_SIZEPer-subscriber static buffer in zenoh shim1024nros-rmw-zenoh
ZPICO_SUBSCRIBER_LARGE_SIZElarge size-class slot, for subscriptions whose type does not fit the small block16384nros-rmw-zenoh
ZPICO_MAX_LARGE_SUBSCRIBERSHow many large-class blocks this image reserves. 0 is legal (phase-403 W4): an image whose subscribed types all fit ZPICO_SUBSCRIBER_BUFFER_SIZE declares 0 and stops paying RING_DEPTH x LARGE_SIZE — 65,536 B at the defaults — for a class it never routes into. A hint no class can hold then fails create_subscription rather than dropping every sample.2nros-rmw-zenoh
ZPICO_SERVICE_BUFFER_SIZEPer-service-server static buffer in zenoh shim1024nros-rmw-zenoh
ZPICO_GET_REPLY_BUF_SIZEStack buffer for service client replies4096zpico-sys
ZPICO_GET_POLL_INTERVAL_MSSingle-threaded polling interval in zenoh_shim_get()10zpico-sys
NROS_SMOLTCP_MAX_SOCKETSMax concurrent TCP sockets (smoltcp); brokered default since Phase 204.2. Legacy alias: ZPICO_SMOLTCP_MAX_SOCKETS.1 (brokered)nros-smoltcp
NROS_SMOLTCP_MAX_UDP_SOCKETSMax concurrent UDP sockets (smoltcp); 1 by default, 4 with the nros-smoltcp/rtps feature (Phase 204.2). Legacy alias: ZPICO_SMOLTCP_MAX_UDP_SOCKETS.1 (brokered)nros-smoltcp
NROS_SMOLTCP_BUFFER_SIZEPer-socket staging buffer (smoltcp). Legacy alias: ZPICO_SMOLTCP_BUFFER_SIZE.2048nros-smoltcp
NROS_SMOLTCP_CONNECT_TIMEOUT_MSTCP connection timeout (smoltcp). Legacy alias: ZPICO_SMOLTCP_CONNECT_TIMEOUT_MS.30000nros-smoltcp
NROS_SMOLTCP_SOCKET_TIMEOUT_MSTCP read/write timeout (smoltcp). Legacy alias: ZPICO_SMOLTCP_SOCKET_TIMEOUT_MS.10000nros-smoltcp

XRCE-DDS (NROS_XRCE_*)

These are read by nros-rmw-xrce-cffi’s build script, either from the environment or — on Zephyr — from CONFIG_<name> in .config. They set C #defines of the same name without the NROS_ prefix; the define is not itself an environment variable, so exporting XRCE_BUFFER_SIZE has no effect and reports no error.

VariableDescriptionDefaultMinCrate
NROS_XRCE_BUFFER_SIZEPer-slot receive buffer. See the note below — this is the receive ceiling.102464nros-rmw-xrce
NROS_XRCE_SUBSCRIBER_RING_DEPTHQueued samples per subscriber321nros-rmw-xrce
NROS_XRCE_MAX_SUBSCRIBERSMax concurrent subscribers81nros-rmw-xrce
NROS_XRCE_MAX_SERVICE_SERVERSMax concurrent service servers41nros-rmw-xrce
NROS_XRCE_MAX_SERVICE_CLIENTSMax concurrent service clients41nros-rmw-xrce
NROS_XRCE_STREAM_HISTORYReliable stream history depth; sizes the per-session output buffer164nros-rmw-xrce
NROS_XRCE_CUSTOM_TRANSPORT_MTUCustom transport MTU; stream buffers are MTU x STREAM_HISTORY4096128nros-rmw-xrce

Dropping MAX_SUBSCRIBERS, MAX_SERVICE_* and SUBSCRIBER_RING_DEPTH to 1, BUFFER_SIZE to 256, STREAM_HISTORY to 4 and CUSTOM_TRANSPORT_MTU to 512 takes the session struct from ~390 KB to ~10-20 KB.

NROS_XRCE_BUFFER_SIZE is the XRCE receive ceiling

A subscriber’s receive ring entry is a fixed uint8_t data[XRCE_BUFFER_SIZE], so a subscription’s own buffer size cannot raise it: asking for create_subscription_sized::<M, 16384> still stops at 1024, because the 16384 buffer is the destination of a copy that never happens. A sample that does not fit is refused on take with MessageTooLarge.

The static cost is XRCE_SUBSCRIBER_RING_DEPTH x XRCE_BUFFER_SIZE per subscriber, which is why the default is small — raise it deliberately, and consider lowering the ring depth at the same time.

Raising it stops helping at the transport MTU: at 4096 samples arrive corrupted rather than refused, with no error and no counter. That is issue 0819, open at time of writing. Keep payloads comfortably below the MTU.

Compile-time only (not environment variables)

These are #defines in packages/rmw/xrce/nros-rmw-xrce/src/internal.h with no env or Kconfig knob. Changing them means editing that header.

DefineDescriptionDefault
XRCE_ENTITY_CREATION_TIMEOUT_MSTimeout for entity creation1000
XRCE_SERVICE_REPLY_TIMEOUT_MSPer-attempt service reply timeout50
XRCE_SERVICE_REPLY_TOTAL_MSTotal service reply budget5000
XRCE_SESSION_FLUSH_TIMEOUT_MSSession flush timeout100
XRCE_SESSION_CREATION_RETRIESSession creation retries3
XRCE_MAX_PENDING_REPLIESIn-flight service replies4
XRCE_SERVICE_REQUEST_RING_DEPTHQueued service requests per server4
XRCE_DEFAULT_AGENT_PORTDefault agent port2018

Core (NROS_*)

VariableDescriptionDefaultCrate
NROS_EXECUTOR_MAX_CBSMax executor callback slots (compile-time fixed array size)4nros-node
NROS_EXECUTOR_ARENA_SIZEExecutor arena size in bytes (compile-time fixed array size)4096nros-node
NROS_SUBSCRIPTION_BUFFER_SIZEDefault subscription/service buffer size (bytes)1024nros-node
NROS_EXECUTOR_MAX_HANDLESMax handles in a C API executor16nros-c
NROS_MAX_SUBSCRIPTIONSMax subscriptions in a C API executor8nros-c
NROS_MAX_TIMERSMax timers in a C API executor8nros-c
NROS_MAX_SERVICESMax services in a C API executor4nros-c
NROS_LET_BUFFER_SIZEBuffer size for LET semantics per handle512nros-c
NROS_MESSAGE_BUFFER_SIZEMax buffer size for subscription/service data4096nros-c
NROS_MAX_CONCURRENT_GOALSMax concurrent goals per action server (compile-time constant, not env-var configurable)4nros-c
NROS_MAX_PARAMETERSMax parameters in parameter server32nros-params
NROS_MAX_PARAM_NAME_LENMax parameter name length64nros-params
NROS_MAX_STRING_VALUE_LENMax string parameter value length256nros-params
NROS_MAX_ARRAY_LENMax parameter array length32nros-params
NROS_MAX_BYTE_ARRAY_LENMax byte array parameter length256nros-params