Questions on Zero-Copy for Variable-Size Messages (PointCloud2) with Iceoryx in ROS 2
Developer hits roadblock sending 5.2MB LiDAR point clouds without copying memory in ROS 2.
A developer optimizing high-bandwidth LiDAR data transmission in ROS 2 has hit a significant technical wall. While they've successfully implemented zero-copy communication using Eclipse Iceoryx middleware for fixed-size messages, they're struggling to apply the same efficiency to variable-size sensor_msgs/PointCloud2 data, where each message can reach 5.2MB. The fundamental problem is architectural: Iceoryx requires pre-allocated memory pools with fixed chunk sizes, but point cloud data varies dynamically based on the LiDAR's detected points.
Community expert 'hidmic' provided a sobering assessment: the standard answer is that you don't handle variable-size messages in zero-copy. They outlined three potential paths forward. First, developers with middleware control can implement allocation APIs (rmw_publisher_allocation_t) to pre-allocate and loan messages. Second, they can craft custom fixed-size messages, as demonstrated in early Iceoryx demos. Third, they can use rclcpp's intraprocess communication as a workaround. The response also pointed to future solutions, including NVIDIA's work on GPU memory buffers and an upcoming reference implementation of draft specification REP-0157, expected to land with the ROS 2 Lyrical release.
- Iceoryx zero-copy requires fixed-size memory pools, conflicting with variable 5.2MB PointCloud2 messages
- Community expert states variable-size zero-copy isn't standardly supported, suggesting custom fixed messages or intraprocess comms
- Future ROS 2 Lyrical release will include native buffer types and REP-0157 implementation for this exact problem
Why It Matters
Solving this enables real-time autonomous systems to process massive sensor data without performance-killing memory copies.