Ask Your Question
0

Number of TCP connections for a "bidirectional" topic?

asked 2019-10-11 10:25:08 -0500

CodeFinder gravatar image

Hi all,

I have a (possibly) simple question: assume if I have two nodes A, B that communicate over a topic "/my_topic", i.e., both nodes subscribe and publish to "/my_topic" using TCPROS. How many TCP connections are being created for this? (I am asking because I am concerned with race conditions in my parallel system of many ROS nodes, most probably due to messages being sent to a topic but the intended receiver(s) is/are not already connected.)

According to the ROS 1: Technical Overview, I would assume that there are two TCP connections, one for the publisher on node A and one for B (although and unfortunately, one would be enough).

In other words: in theory, it would be sufficient to just have ONE TCP connection which is used in both directions. In that the case here?

Is that correct?

Thank you so much! :-)

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2019-10-11 10:51:55 -0500

1)

both nodes subscribe and publish to "/my_topic" using TCPROS.

don't do that. You're not going to know what came from who unless you encoded it in the message, but either way there's going to be alot (50%) of waste both nodes have to deal with. Triggering callbacks to decode wasteful messages isn't "free". Just use 2 topics /my_topic/A & /my_topic/B or something.

2) Yes, there are 2, each connection will get one. Without g oing deeper into the ros comms layers, I don't believe that is possible (or even if you did).

edit flag offensive delete link more

Comments

Thanks for clarifying! Unfortunately, I need a single topic in my case and in fact, there are many more robots subscribing and publishing to that single topic (because I require that every robot communicates with every other robot (O(n²)) and I see no other way of achieving this (except for using a topic). Do you?

CodeFinder gravatar imageCodeFinder ( 2019-10-15 04:25:10 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-10-11 10:25:08 -0500

Seen: 18 times

Last updated: Oct 11