Rosanswers logo


The above link quotes that:

Establishing a topic connection: Putting it all together, the sequence by which two nodes begin exchanging messages is:

  1. Subscriber starts. It reads its command-line remapping arguments to resolve which topic name it will use. (Remapping Arguments)
  1. Publisher starts. It reads its command-line remapping arguments to resolve which topic name it will use. (Remapping Arguments)
  2. Subscriber registers with the Master. (XMLRPC)
  3. Publisher registers with the Master. (XMLRPC)
  4. Master informs Subscriber of new Publisher. (XMLRPC)
  5. Subscriber contacts Publisher to request a topic connection and negotiate the transport protocol. (XMLRPC)
  6. Publisher sends Subscriber the settings for the selected transport protocol. (XMLRPC)
  7. Subscriber connects to Publisher using the selected transport protocol. (TCPROS, etc...)

In the above mentioned steps , the subscriber is requesting for the connection first and then the publisher is sending the settings for the protocol . So isn't it a two way here in topics as well . Where does the exact difference between a topic and a service comes from ?

Originally posted by sam26 on ROS Answers with karma: 231 on 2017-01-25

Post score: 1


1 Answer 1


Rosanswers logo

See the wiki Concept page

Whereas Pub/Sub is many-to-many, one-way transport, Services are one-to-one, two-way transport providing the Request/Reply pattern.

The page you are refering to shows how the actual connection is set up. Basically, this describes that each publisher/subscriber has to register at the master, but the actual topic transmission is happening between the two directly. However, any number of publisher/subscribers to one topic can exist. However, you can only have one service server (i.e. service provider) for one type (name) of a service.

Originally posted by mgruhler with karma: 12390 on 2017-01-25

This answer was ACCEPTED on the original site

Post score: 4

Original comments

Comment by sam26 on 2017-01-25:
So , does it mean that establishing a connection can have either way communication depending on transport protocol selected,while during the actual transfer of data , topics can only send data from publisher to subscriber and services need a request from the subscriber first ?

Comment by suforeman on 2017-01-25:
The "service" is a procedure call and is synchronous. The caller waits from the response. The "topic" is asynchronous. The publisher of a message on a topic has no guarantee when the subscriber will process the message.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.