ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

IPC on separate executors

asked 2022-04-07 08:44:58 -0600

renob321 gravatar image

It's not very straight forward how to use IPC correctly, or at least my understanding so far. When i look at the demo material link, the nodes are created in main, but I would like to launch them. I know it's possible to pass 'use_inter_process_comms' as NodeOption, but it's not obvious to me if it's works with two seperate 'ros run ....' or 'ros launch ...'. So to define my question, will IPC work without launching the nodes with the same executor? And does IPC support all QoS?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-04-07 18:57:44 -0600

ijnek gravatar image

updated 2022-04-07 18:58:36 -0600

From your question, it seems like you may be confused about the confusing acronym "IPC".

In general, IPC refers to "inter-process communication", communication between processes.

The link you're referring to, points to "intra-process communication", which is communication between nodes in a single process. Note that there's a mistake in your question, you should be passing use_intra_process_comms.

ROS2 communication uses inter-process by default, but by enabling intra-process, you can use zero-copy transport for faster message transport.

If you have two separate ros2 run or ros2 launch, then they are running in separate processes, and you won't be able to have intra process communication between them.

To your other questions:

  • Having multiple executors in one node: intra-proces communication should work (although I haven't actually tried this out).
  • Does IPC support all QoS: yes, it should.
edit flag offensive delete link more


Yes, you are right. I used the term IPC quite loosely, i really meant IPC as in using a shared memory space which can take advantage of zero-copy. So to have zero copy I really need to put my nodes in a composable container and have them run in the same thread? I think this is the case from looking at the intra-comms demos.

renob321 gravatar image renob321  ( 2022-04-08 02:43:46 -0600 )edit

Correct, to have intraprocess zero-copy you have to put your nodes in one program, but not necessarily in the same thread (since one process can have multiple threads and they share the same memory space), as well as follow the instructions you linked to in your original question.

As a side note, the term shared memory, usually means something else. (it is a mechanism to share a block of memory between more than one process). There is recent work being done for this in ROS2, but it requires allocating chunks of memory and is quite a bit harder to get working.

ijnek gravatar image ijnek  ( 2022-04-08 02:59:03 -0600 )edit

Yes a process can have multiple threads, but i need to expect a single thread when it's only used with a single thread executor. For example main() of the example i previously linked. Yes shared memory is used, with mmap to achieve zero-copy, for example with, which cyclonedds uses. is it triggered by 'use_intra_process_comms'?

renob321 gravatar image renob321  ( 2022-04-08 04:15:32 -0600 )edit

Eclipse iceoryx tries to achieve true zero-copy inter-process communication, and isn't related to the use_intra_process_comms flag. Iceoryx tries to deal with the zero-copy at the DDS level.

ijnek gravatar image ijnek  ( 2022-04-08 05:06:29 -0600 )edit

Okey, so intra_comms have nothing todo with DDS, good to know. But how do I let CycloneDDS know that I want zero-copy between two nodes? or is it default?

renob321 gravatar image renob321  ( 2022-04-08 07:08:28 -0600 )edit

At this point, it may be better to start a new question, but make sure you understand that Eclipse iceoryx and Eclipse cyclonedds are different.

Eclipse iceoryx is the one that has zero-copy interprocess. See the README of to run their demos. Once you run those demos, consider if the zero-copy interprocess is absolutely necessary for what you're trying to achieve as there are draw backs, like not being able to use dynamic message types like vectors.

ijnek gravatar image ijnek  ( 2022-04-08 07:18:47 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2022-04-07 08:44:58 -0600

Seen: 50 times

Last updated: Apr 07