ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Having confusion over nodes’ communication methods: by topics and by service.

asked 2015-01-12 11:17:38 -0500

A.M Dynamics gravatar image

updated 2015-01-12 11:27:33 -0500

I have confusion over nodes’ communication methods. So far what I’ve understood is that there is two ways which are by topics and by service. Please correct me if I am not right.

1- In both methods, massages are used for sending and receiving information.

2- In communication by topic only one node can publish to a topic but several nodes can subscribe to that topic.

3- The communication by service is the way that only two nodes can send and receive information by messages.

Now, If all of the above statements are correct, my question is whether it is possible that a node subscribes/publishs to a topic and at the same time it communicates to another node(in another package) using service method? If it is, how can I do that?

Thanks for considering my question.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2015-01-12 12:45:18 -0500

dornhege gravatar image
  1. No, Services communicate by their own protocol. However the related actionlib uses messages, although I wouldn't think of it that way for application purposes.

  2. No, Any number of nodes can subscribe or publish to the same topic. In that case each subscriber gets messages from each publisher.

  3. A service connected is node-to-node only for a single request.

For the last point: Given that service calls are blocking, you'll need to use a multi-threaded approach.

edit flag offensive delete link more


Many thanks. For the last point, as you said, I need to use a multi-threaded approach. Is there any tutorial how to apply a multi-threaded in ROS?

A.M Dynamics gravatar image A.M Dynamics  ( 2015-01-12 13:33:42 -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


Asked: 2015-01-12 11:17:38 -0500

Seen: 179 times

Last updated: Jan 12 '15