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

Publish or subscribe to another roscore/master

asked 2021-02-10 14:42:10 -0600

azerila gravatar image

updated 2021-02-10 14:42:20 -0600

Say we have two roscores one with URI1 and another with URI2. We have a code running in a cpp file in URI1 where given a condition we want to publish a message but to obtained from a subscriber in URI2.

Similarly, if we have a subscriber running in URI1, we want to to only obtain messages that are published to that topic but within the codes that are running in URI2.

For example in a code that is running under URI of "http://localhost:"11311":

realtime_tools::RealtimePublisher<std_msgs::string> publisher_;
publisher_.unlockAndPublish("http://localhost:"11312")
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2021-02-18 21:56:36 -0600

loguna gravatar image

If I not mistaken, only one roscore/ master can be present. Try ROS SSH to transmit messages from one PC/ controller to another.

edit flag offensive delete link more
0

answered 2021-02-19 00:03:16 -0600

ROS 1 is designed to run with a single roscore. You can play various games to make nodes from one roscore talk to another roscore but I wouldn't recommend it, since that can go off the rails quickly.

To exchange data between nodes from different roscore instances, I would suggest using "something else" as the bridge. I would first suggest trying ROS 2 as the "something else" bridge protocol, but you could also try any number of things in this role (depending on the message load), including web services of various kinds, various IoT protocols, "raw" DDS, etc. Doing this in the general case is hard (see the eProsima Integration Service as one example) and the potential payoff of hand-crafted vs general-purpose translation depends on how much data you want to push around, how many datatypes, how frequently those datatypes change, etc.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2021-02-10 14:42:10 -0600

Seen: 530 times

Last updated: Feb 19 '21