Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example deployment with Data Sharing via LoanedMessage #31

Closed
fujitatomoya opened this issue Oct 22, 2023 · 2 comments
Closed

Add example deployment with Data Sharing via LoanedMessage #31

fujitatomoya opened this issue Oct 22, 2023 · 2 comments

Comments

@fujitatomoya
Copy link
Owner

I had this question during ROSCon 2023 presentation.
I believe that this is one of the use case to show how we can use the data sharing zero copy even with container and Kubernetes.
Certain constraints that we need to assign the containers in the same pod as localhost, but for the explanation this makes sense to add the example here.

@fujitatomoya
Copy link
Owner Author

export ROS_DISABLE_LOANED_MESSAGES=0 this needs to be done, since ros2/rcl#1110

some experimental check... using docker container.

  • binding /dev/shm is the only requirement to use shared memory transport and data sharing provided by Fast-DDS
tomoyafujita@~/DVT >docker run -it --network host -v /dev/shm:/dev/shm tomoyafujita/ros:rolling

root@tomoyafujita:~# ls -lt /dev/shm/
total 0

root@tomoyafujita:~# ros2 daemon status
The daemon is not running


root@tomoyafujita:/# ros2 run demo_nodes_cpp talker_loaned_message
[INFO] [1703119123.500535244] [loaned_message_talker]: Publishing: '1.000000'
[INFO] [1703119123.500835352] [rclcpp]: Currently used middleware can't loan messages. Local allocator will be used.
[INFO] [1703119123.500871185] [loaned_message_talker]: Publishing: 'Hello World: 1'
[INFO] [1703119124.500472323] [loaned_message_talker]: Publishing: '2.000000'
[INFO] [1703119124.500608551] [loaned_message_talker]: Publishing: 'Hello World: 2'
...
  • what if only host network interface is shared? (host system case does not have this case, since everyone should have /dev/shm in the same namespace.)
tomoyafujita@~/DVT >docker run -it --network host -v /dev/shm:/dev/shm tomoyafujita/ros:rolling

root@tomoyafujita:/# ros2 node list

root@tomoyafujita:/# ros2 topic list
/chatter
/chatter_pod
/parameter_events
/rosout

interesting ths case, we cannot see the nodes but topic list. i think Simple Participant Discovery Protocol (SPDP) uses shm transport, so that participants cannot discover each other. on the other hand, Simple Endpoint Discovery Protocol (SEDP) falls back to multicast based default discovery, that can discover the DataReader and DataWriter, so we can see the topics.

eProsima/Fast-DDS#3753 related to this behavior, see more details for https://fast-dds.docs.eprosima.com/en/latest/fastdds/discovery/simple.html#simple-discovery-settings

Note:

root@da343f3b6b7d:/# fastdds shm clean
shm.clean:
0 ports in use
0 segments in use
3 zombie ports cleaned
2 zombie segments cleaned

@fujitatomoya
Copy link
Owner Author

closing in favor of #33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant