This document describes the vehicle-side navigation runtime: service ownership, startup order, ZeroMQ responsibilities, routing, route guidance, and the intended turn-by-turn lifecycle.
Map generation and deployment are documented separately in docs/navigation_deployment.md. Public message schemas are documented under docs/idd/.
Start a route, then select Simulate to play its geometry at the selected time scale. Android bridge and gpsd profiles support playback inside the navigation service: their live receivers keep running, and the bridge continues reporting real GPS. Only ORC's delivered navigation positions switch to route-simulation. The UI labels playback and offers Stop simulation. Stopping playback, ending the route, or reaching its destination resumes fresh live reports. Service shutdown clears playback; a restart always starts with the configured live source. Browser and standalone simulation profiles retain their existing playback support. No bridge configuration change or native renderer rebuild is required.
Owns the process-wide ZeroMQ XPUB/XSUB broker. Producers connect to the publisher ingress endpoint and consumers connect to the subscriber egress endpoint. The broker contains no navigation policy.
Runtime wrapper: scripts/runtime/start_zeromq_broker.sh
Installer: scripts/systemd/install_message_broker_systemd.sh
Owns the local Valhalla HTTP routing engine and reads the deployed routing dataset. It calculates routes but does not own the active navigation session.
Runtime wrapper: scripts/runtime/start_valhalla.sh
Installer: scripts/systemd/install_valhalla_systemd.sh
Owns vehicle navigation state and the navigation command endpoint. It publishes normalized navigation telemetry and uses Valhalla when route planning is enabled.
The production target is for this same service to own the active NavigationSessionController and RouteGuidanceController. Keeping session and guidance ownership here prevents a second daemon from having to duplicate active-route state.
Runtime wrapper: scripts/runtime/start_navigation_service.sh
Installer: scripts/systemd/install_navigation_service_systemd.sh
When launched manually, the runtime wrapper detects an active installed openroadcode-navigation.service, stops that known unit, and restores it when the foreground process exits or receives a terminal signal. It never terminates an unidentified process merely because a navigation port is occupied. The handoff requires permission to control the system unit; if sudo or the host security policy denies that operation, the wrapper exits before opening another navigation runtime. The installed unit marks its own wrapper invocation so the handoff cannot recursively stop the service during systemd startup.
Install the complete runtime stack from the repository root:
This installs the routing runtime—message broker, Valhalla, and navigation. The separately scoped telemetry installer adds navigation and automotive producers but does not install Valhalla; use the navigation-runtime installer when route calculation is required.
The installer creates and enables services in dependency order:
The navigation unit orders itself after the broker and Valhalla so telemetry and routing dependencies are available before navigation starts. gpsd.service is also ordered before navigation when present.
Check the complete stack with:
Logs are available through journald:
The intended production lifecycle is:
NavigationSessionController owns rerouting policy. RouteGuidanceController derives route-relative state but does not decide when a replacement route should be calculated.
CarUi and other presentation clients must not call Valhalla directly or implement rerouting policy. They request navigation actions through the navigation command interface and subscribe to public navigation/guidance state.
Navigation telemetry and route guidance are presentation-neutral contracts transported through the ZeroMQ broker.
Route guidance is published on route_guidance.state. See docs/idd/route_guidance_state.md for the versioned JSON schema, SI units, nullable maneuver fields, and consumer requirements.
The broker is transport only. Coordinate-frame semantics, units, source identity, validation, and schema versioning belong to the individual messaging contracts and IDDs.
Each systemd unit uses restart-on-failure semantics. A failed UI must not terminate navigation services. A failed navigation consumer must not affect the broker or producer.
If Valhalla is unavailable, navigation telemetry should remain independently useful even though route calculation cannot succeed. The navigation service owns graceful reporting of route-planning availability to command clients.
Port/address conflicts are configuration or deployment errors. Services should fail with a clear diagnostic rather than silently selecting another endpoint, because consumers rely on stable configured endpoints.
Controller behavior is covered by unit tests under:
Messaging contract tests live with their contracts. End-to-end navigation/guidance exercises live under apps/common/component_test/.
Static systemd/runtime wiring tests live under:
Before merging navigation runtime changes, run at minimum:
On a Raspberry Pi deployment target, also verify the real boot boundary:
A reboot test is required before treating startup changes as deployment-ready.
Terrain orientation labels use the installed offline vector map, including local streets at zoom 13 and above. Names accept the same name:latin field as the regular map. City labels also read zoom-10 parent tiles when detailed tiles omit them. The toolbar toggle names the view it opens (Terrain from Map, Map from Terrain). Terrain/building packs are selected when the viewer opens; camera movement does not yet switch those packs.
The embedded Terrain watchdog tolerates two consecutive browser polling timeouts; a successful poll resets that budget. Three consecutive timeouts or a confirmed process/X11 failure returns to Map with a logged reason. Browser output is in cesium-embedded.log; capture the ORC launcher output too when diagnosing an unexpected fallback.
Terrain street labels appear within 1 km of the camera; distant streets in tilted views stay hidden. City and freeway labels remain eligible farther out. Cesium handles distance visibility directly; no repeated screen-projection or label visibility mutations run after rendering. Road labels are capped at eight per tile, and local streets add labels without extra ground-clamped road geometry. Zooming changes label visibility even when the same vector tiles stay loaded.
The Terrain road/place overlay is temporarily disabled for all viewer launches while investigating repeated Termux:X11 crashes. Its Roads control is disabled. Regular Map labels and installed imagery, terrain and building packs are unchanged. This isolation step does not establish the GPU/X11 crash cause.
For embedded Terrain renderer selection, the normal launch obeys Chromium's GPU safety decisions. OPENROAD_CESIUM_RENDERER=hardware-override ./runOrcUi passes --ignore-gpu-blocklist for explicitly qualified virtual GPUs such as a tested VMware SVGA3D configuration. This can be faster, but remains opt-in because a blocklisted driver can corrupt rendering, lose its WebGL context or crash the GPU process. OPENROAD_CESIUM_RENDERER=software ./runOrcUi instead requests Chromium ANGLE SwiftShader WebGL, disables Vulkan and GPU compositing, and is the slower fallback when hardware WebGL is unavailable. Both modes leave the normal launch unchanged. They isolate the browser rendering backend, not every native ORC/X11 graphics path; Android process kills and memory pressure still require device evidence. The Cesium stage log records the selected mode, effective flags and Chromium GPU report for diagnosis.
Embedded Terrain writes flushed JSON stage records to cesium-stages.log alongside cesium-embedded.log. Records include requested backend/flags, attachment, Chromium browser-target SystemInfo.getInfo GPU attributes before navigation (when available), page initialization stages, first-frame readiness and startup failure. Diagnostics create no extra WebGL context and missing diagnostic support does not block launch.