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

Revision history [back]

click to hide/show revision 1
initial version

ROS is designed so that communication between nodes, regardless of where they are running, happens through the ROS master.

I'm not familiar with UWSIM, but if it's a sim that just has ROS plugins the following architecture is pretty standard: You can write your nodes so that each robot has a publisher and subscriber.

When you initialize a publisher or subscriber with a topic:

ros::Publisher chatter_pub = n.advertise<std_msgs::String>("chatter", 1000);

That topic is created and the ROS master handles all communication to it. In this case the topic is called chatter. Aside from writing the publisher/subscriber nodes there are no additional steps to take when you want a topic created.

So, for each simulated robot you would have a node that handles outbound communication through a publisher and inbound through a subscriber. If your robots are called rob_one and rob_two, then their publishers can publish on topics: rob_one_timestamp and rob_two_timestamp, respectively. Then rob_one's subscriber can subscribe to rob_two_timestamp and vice versa.

It's a bit tough without seeing some of your code, and your CMakeLists.txt to understand why it isn't compiling.