Why the Trajectory Controller Does Not Share a Process With the Camera Driver

We are splitting the motion stack into separate OS processes and moving data between them through iceoryx2 shared memory. The alternative was to put everything in one ROS 2 component container with intra-process communication. That design was quicker to build and cheaper per message on paper. It lost because a segmentation fault in any loaded component kills every other component in the same address space, including the one node that must command a safe stop.

The rejected option, argued at its strongest

A single rclcpp component container on Jazzy with intra-process communication enabled gives true zero-copy for unique_ptr messages, with no serialization on the hot path. It also means one executor to reason about and one launch unit to deploy. Discovery traffic shrinks because the DDS layer barely takes part, and lifecycle transitions for the whole stack can be run from one place. Profiling is simpler when every callback lives in one process, and the team already knows the pattern from Nav2 composition. If every node in the stack is first-party, reviewed and tested to the same standard, this is the right answer, and we would not argue against it.

Where shared fate breaks it

Our stack is not uniform. The perception components wrap a vendor camera SDK and a GPU inference runtime that we cannot audit, while the trajectory controller and the safety monitor are the parts our safety case actually depends on, and that case is written against functional safety standards such as IEC 61508 and its sector derivatives. In one container, a null dereference inside the vendor SDK kills the controller at the same moment, so the robot loses the node that would have slowed it down, and the hardware watchdog on the drive is all that is left. With separate processes, the same crash just makes a topic go quiet. The controller keeps running, its perception subscription uses AUTOMATIC liveliness with a lease duration of 100 ms, and when the lease expires the liveliness callback puts the controller into a degraded mode that holds position or follows the last validated path at reduced speed. That reaction lives in code we own and test, which is the reason for the whole decision.

The decision rule, and what would have flipped it

Two nodes may share a container only when they already share fate, meaning neither can do anything safe without the other, and both have the same level of trust in our safety argument, so if the vendor SDK were replaced by a driver we wrote and verified to the same standard as the controller, the single container would have won and this record would argue the opposite.

What cross-process zero-copy costs us

iceoryx2 keeps large payloads such as point clouds and image frames out of the serialization path: publishers loan samples in a shared memory segment, and subscribers in other processes map that segment read-only. The price is that message types must be fixed size or bounded. Unbounded sequences in our sensor messages had to become bounded ones with explicit maxima, and that schema decision stays with us for good. We also accept a cross-process handoff that our own bench measurement puts, as an estimate, at a few microseconds slower than the intra-process path, which is negligible against a control period measured in milliseconds. The harder cost is operational: after a kill, shared memory segments, loans still held by the crashed publisher and stale services all need cleaning up, and iceoryx2 dead node detection only does this when called, so the supervisor runs that cleanup before it restarts any process. That leaves one open question for the freeze: the supervisor may now be the new single point of failure, so the next record covers running it under systemd with its own watchdog instead of as a ROS node.

Why not use the shared memory transport already built into CycloneDDS or Fast DDS instead of adding iceoryx2?

Both can carry data over shared memory, and that would keep the process isolation we want. What we needed was explicit, testable control over loan ownership and over cleanup after a crashed publisher. Using iceoryx2 directly gives us those controls as API calls the supervisor can make, instead of behavior buried in vendor transport settings that we would have to re-check after every middleware update.

Back to RoboticsMiddleware · Domains

← Back to RoboticsMiddleware
Engineering & Architecture Brief

Why the Trajectory Controller Does Not Share a Process With the Camera Driver

We are splitting the motion stack into separate OS processes and moving data between them through iceoryx2 shared memory. The alternative was to put everything in one ROS 2 component container with intra-process communication. That design was quicker to build and cheaper per message on paper. It lost because a segmentation fault in any loaded component kills every other component in the same address space, including the one node that must command a safe stop.

The rejected option, argued at its strongest

A single rclcpp component container on Jazzy with intra-process communication enabled gives true zero-copy for unique_ptr messages, with no serialization on the hot path. It also means one executor to reason about and one launch unit to deploy. Discovery traffic shrinks because the DDS layer barely takes part, and lifecycle transitions for the whole stack can be run from one place. Profiling is simpler when every callback lives in one process, and the team already knows the pattern from Nav2 composition. If every node in the stack is first-party, reviewed and tested to the same standard, this is the right answer, and we would not argue against it.

Where shared fate breaks it

Our stack is not uniform. The perception components wrap a vendor camera SDK and a GPU inference runtime that we cannot audit, while the trajectory controller and the safety monitor are the parts our safety case actually depends on, and that case is written against functional safety standards such as IEC 61508 and its sector derivatives. In one container, a null dereference inside the vendor SDK kills the controller at the same moment, so the robot loses the node that would have slowed it down, and the hardware watchdog on the drive is all that is left. With separate processes, the same crash just makes a topic go quiet. The controller keeps running, its perception subscription uses AUTOMATIC liveliness with a lease duration of 100 ms, and when the lease expires the liveliness callback puts the controller into a degraded mode that holds position or follows the last validated path at reduced speed. That reaction lives in code we own and test, which is the reason for the whole decision.

The decision rule, and what would have flipped it

Two nodes may share a container only when they already share fate, meaning neither can do anything safe without the other, and both have the same level of trust in our safety argument, so if the vendor SDK were replaced by a driver we wrote and verified to the same standard as the controller, the single container would have won and this record would argue the opposite.

What cross-process zero-copy costs us

iceoryx2 keeps large payloads such as point clouds and image frames out of the serialization path: publishers loan samples in a shared memory segment, and subscribers in other processes map that segment read-only. The price is that message types must be fixed size or bounded. Unbounded sequences in our sensor messages had to become bounded ones with explicit maxima, and that schema decision stays with us for good. We also accept a cross-process handoff that our own bench measurement puts, as an estimate, at a few microseconds slower than the intra-process path, which is negligible against a control period measured in milliseconds. The harder cost is operational: after a kill, shared memory segments, loans still held by the crashed publisher and stale services all need cleaning up, and iceoryx2 dead node detection only does this when called, so the supervisor runs that cleanup before it restarts any process. That leaves one open question for the freeze: the supervisor may now be the new single point of failure, so the next record covers running it under systemd with its own watchdog instead of as a ROS node.

Technical FAQ: Why not use the shared memory transport already built into CycloneDDS or Fast DDS instead of adding iceoryx2?

Both can carry data over shared memory, and that would keep the process isolation we want. What we needed was explicit, testable control over loan ownership and over cleanup after a crashed publisher. Using iceoryx2 directly gives us those controls as API calls the supervisor can make, instead of behavior buried in vendor transport settings that we would have to re-check after every middleware update.

Related Architecture Specifications (ROBOTICS): roboticagv.com · surveillanceugv.com · ugvswarm.com

More Technical Articles on roboticsmiddleware.com

Benchmarking DDS Implementations for Sub-Millisecond Robotics Closed-Loop Control →Designing Secure, Authenticated DDS Networks for Factory-Wide Robotics Deployment →Why the Controller Does Not Share an Address Space with Perception: An ADR on Failure Domains in ROS 2 Jazzy →