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

Reasoning for using Pub/Sub vs Service

asked 2017-01-09 14:03:42 -0500

waspinator gravatar image

I'm struggling to determine when I should use the various communication methods ROS offers, like the publish/subscriber model, service, or action.

I figure, sensors should be publishers, short running processes can be services, and longer running ones should be actions. Do those make sense? Are there other rules of thumb to follow?

For example, I was looking at the rosserial tutorial for controlling a servo motor, and saw it was using a subscriber to move. I would have chosen a service. What would be the reasoning for choosing one over the other?

http://wiki.ros.org/rosserial_arduino...

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-01-09 16:58:57 -0500

ahendrix gravatar image

This question explains the reasoning and scenarios for each pretty well: http://answers.ros.org/question/11834...

This is also documented on the ROS Communication Patterns page that is linked from that question.

edit flag offensive delete link more

Comments

so for the example of controlling a servo motor, it should be a topic if its continuously updating its position, a service if its a quick movement with discrete move requests, and an action if its slow?

waspinator gravatar image waspinator  ( 2017-01-15 21:55:01 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2017-01-09 14:03:42 -0500

Seen: 2,058 times

Last updated: Jan 09 '17