How to use ROS 2 shared memory in snaps | Ubuntu

If you already tried to package ROS 2 Foxy applications into snaps, you might have encountered the following error regarding shared memory:

[RTPS_MSG_OUT Error] Domain name: fastrtps -> Function compute_per_allocation_extra_size
[RTPS_TRANSPORT_SHM Error] Failed to create segment bed1660b134d4b19: Permission denied -> Function compute_per_allocation_extra_size
[RTPS_MSG_OUT Error] Permission denied -> Function init

This log is stating that FastDDS (formerly known as FastRTPS) couldn’t create a file for the shared memory mechanism due to denied permission. Fortunately, FastDDS is smart enough to fallback to a non-shared memory-based option, allowing your program to run just fine.

In this post, we will review the shared memory mechanism in ROS 2, explain why this error is happening in snaps and propose different solutions to tackle it in strictly confined snaps. We therefore assume that you are familiar with both ROS 2 and snaps. If not, have a look at either (or both) the ROS 2…

Source link