Dynamically switching subscribers / domain id / namespace of an executable

asked 2021-08-18 03:36:37 -0500

FHelsch gravatar image


we have a graphical UI which we are using to visualize the data from a device which has several sensors. For the communication between the device and the UI program we are using ROS 2. But we have multiple of these device and only want to visualize one of them at a time, but want to be able to switch the between the devices in the UI.

We have already tried to change the ROS_DOMAIN_ID, but this did not affect the running executable (we also tried adjusting the environment variable programmatically from within this executable). And so far we were unable to find an option to access/update the domain programmatically with the ROS 2 API.

We have also looked into namespaces, but so far we were not able to find clear information about whether the concept of namespaces in addition to topics also applies to ROS 2 (or only to ROS 1) and if there is a possibility to access/change these namespaces programmatically.

So basically our question is: Is it possible in ROS 2 to change the source of subscribers and publishers of an executable while this executable is running ? And in addition it would be nice if we could change the source of all the subscribers and publishers in the executable at once, instead of e.g. restarting every single subscriber with a different topic.

Your help would be very much appreciated.

Version Information: We are currently using ROS 2 Dashing on Ubuntu 18.04 (but also considering to switch to a newer version)

edit retag flag offensive close merge delete


No, I don't think that's currently supported.

Related discussions (I believe):

gvdhoorn gravatar image gvdhoorn  ( 2021-08-18 03:49:09 -0500 )edit

Ok. Either way thanks for the links, they definitely provided some interesting context. It sounds like DDS partitions could be a nice alternative, but support is not (yet) available

FHelsch gravatar image FHelsch  ( 2021-08-19 11:43:24 -0500 )edit

I'm wondering if there is any update on this. I see from this design document dynamic remapping was mentioned. But based on the above conversations and my own digging I can't seem to find any implementation.

rico5678 gravatar image rico5678  ( 2022-03-23 15:13:11 -0500 )edit