0
$\begingroup$

Rosanswers logo

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.


Originally posted by A.M Dynamics on ROS Answers with karma: 93 on 2015-01-12

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

  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.


Originally posted by dornhege with karma: 31395 on 2015-01-12

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by A.M Dynamics on 2015-01-12:
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?

$\endgroup$

Your Answer

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