ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

[ROS2] Communication across multiple local users

asked 2021-02-08 06:50:16 -0500

mjbogusz gravatar image

Is there a way of communicating between 2 ROS2 processes/nodes on the same machine but being run as 2 different users?

My specific use case is one process/node run as root (for interfacing with a piece of hardware) and one as a regular user. However, the two nodes cannot seem to communicate with each other or even 'see' each other, as in: the node nor its topics are not visible via ros2 node list/ros2 topic list.

I've narrowed it down to two nodes running as different users on the same machine - I've spun up a fresh Ubuntu 20.04 Server VM (linux 5.4.0, x86_64), installed ROS2 Foxy, added 2 users and confirmed that ros2 run demo_nodes_cpp talker does not communicate with ros2 run demo_nodes_cpp listener (across different users - running as one user works as expected).

The same test on a Ubuntu 18.04 & ROS2 Eloquent box works as expected, ie the listener receives messages from the talker...

What's peculiar, the /rosout topic on one user shows the logs printed by the node run as the other one (or at least some, I wasn't able to replicate this with the demo/example nodes - perhaps due to log severity being too low).

I've verified that the multicast test (ros2 multicast send/receive) between the users passes successfully.

edit retag flag offensive close merge delete


I don't have a solution but can confirm the problem. But first investigation shows, that the behaviour depends on the existence of a network connection. Without any connected network topics can be seen.

Carsten gravatar image Carsten  ( 2021-02-10 10:00:47 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2021-02-10 10:22:30 -0500

Carsten gravatar image

Changing the DDS to e.g. Cyclone solved the issue for me

edit flag offensive delete link more


That seems more like a work-around?

Have you reported this on the Fast-DDS / Fast-RTPS issue tracker?

gvdhoorn gravatar image gvdhoorn  ( 2021-02-10 10:28:40 -0500 )edit

yes, issue was reported here.

Carsten gravatar image Carsten  ( 2021-02-10 11:16:37 -0500 )edit

In the next ROS2 release, Cyclone will be the default RMW for reasons like these.

phillipov gravatar image phillipov  ( 2021-02-10 13:12:30 -0500 )edit

As posted here the behaviour results from shared memory usage on local machine that is limited by user permissions. As stated in the link above local communication is possible by using UDP communication also on the local machine.

Carsten gravatar image Carsten  ( 2021-02-12 04:46:36 -0500 )edit

I've chosen this answer as the solution as, IMO, it's the least workaround-ish one we have at this time and because this will be the default from Galactic onward.

The other answer, while being a workaround (and potentially having a performance penalty), deserves upvotes too as it presents the real reason behind the problem.

For me, however, the best workaround will probably be to just run the processes as the same user...

mjbogusz gravatar image mjbogusz  ( 2021-02-16 04:00:36 -0500 )edit

answered 2021-02-11 04:42:47 -0500

Iker gravatar image

Since Foxy, FastDDS includes a shared memory transport that is active by default. Two nodes on the same host will establish this as their communication channel. However, by default, shared memory segments created by one user are not accessible by another for security reasons. Right now FastDDS does not support shared memory transport on multi-user environments. We are looking for alternatives to detect multi user scenarios and disable shared memory or somehow support the scenario.

Meanwhile, UDP transport can be enforced by XML configuration, as described here.

edit flag offensive delete link more

Question Tools



Asked: 2021-02-08 06:50:16 -0500

Seen: 1,171 times

Last updated: Feb 10 '21