Why the Controller Does Not Share an Address Space with Perception: An ADR on Failure Domains in ROS 2 Jazzy
We decided to run the motion controller and the perception pipeline as separate processes. They exchange large messages through iceoryx2 shared memory, and we did not compose them into a single rclcpp component container. The deciding factor was failure isolation. Latency hardly entered into it: a segmentation fault in a perception plugin must not take the joint-level control loop down with it. This record states the composed design fairly, explains why we rejected it, and names the condition that would have reversed the decision.
The option we rejected, at its strongest
A single component container running intra-process communication is the cleanest zero-copy path ROS 2 offers. A publisher hands over a unique_ptr, the subscriber receives the same buffer, and nothing is serialized, so there is no loan protocol, no shared memory segment to size, and no second process to schedule. Deployment is one executable, one launch description, and one set of parameters, which removes a whole class of configuration drift between nodes. Tracing is simpler too, because every callback lives on one timeline in one process and profilers see everything at once. On a robot where the whole software stack is developed in-house and held to the same assurance level, this is the design I would pick, and the colleagues who argued for it were right about its operational simplicity.
Why one address space is one failure domain
The failure mode that decided it is mundane. Our perception stack links third-party native code: a GPU inference runtime, a vendor camera SDK, and a point cloud library whose out-of-bounds reads we have already hit once in field logs. In a composed container, any of those faults kills the whole process, so the controller dies mid-trajectory and the drives fall back to their own safe stop. That is safe, but it is an availability event we did not need to have. As separate processes, perception can crash and the controller keeps running. A DDS liveliness QoS with a 50 ms lease duration on the perception topics tells the controller that its inputs are stale, and it moves into a degraded mode it fully controls, such as holding position or ramping down along a planned stop instead of an abrupt one. Shared memory adds a failure mode of its own, a publisher dying while it still holds loaned samples. iceoryx2 detects dead nodes and reclaims their resources, and we test that path explicitly by killing perception under load rather than trusting the documentation.
The decision rule we now apply across the system is simple: components share an address space only when they belong to the same failure domain and the same assurance argument, and anything carrying native code we cannot audit gets its own process, whatever the copy cost.
What would have changed the answer
Two conditions would have flipped this record. The first is assurance parity. If the perception stack had been argued under the same machinery functional safety standards as the controller, such as ISO 13849 and its relatives, with no unaudited native dependencies, then the isolation argument would weaken to the point where composition's simplicity wins. The second is timing. Our estimate is that a cross-process wake-up on a PREEMPT_RT kernel adds jitter in the tens of microseconds, which is negligible against our control period, but a loop running an order of magnitude faster would make that jitter a real share of the budget, and then the composed container would be the only design that fits. Neither condition holds today, but the second one could arrive with the next generation of actuators, so we keep the interfaces message-compatible with composition and treat moving back to it as a configuration change, not a rewrite.
Technical FAQ: Does process separation give up zero-copy for the large perception messages?
No. Point clouds and images still travel as loaned shared memory samples, so the payload is never copied. What we pay for is a cross-process notification and a second process to schedule and supervise, and both costs are small next to the cost of losing the controller every time a perception dependency crashes.