Ask Your Question
0

Best choice for controlling GPIOs (published messages or service calls)

asked 2015-01-12 15:19:52 -0600

epascual gravatar image

Hello,

Sorry if this is an already answered question, but despite a couple of hours spent googling the Web and searching in this forum, I couldn't find.

What is the rule of thumb for deciding if some control operation should be implemented using published messages or service calls ?

For controlling robot moves, I could see that the standard way is to use Twist messages published on the /cmd_vel topic. But what about controlling GPIOs for instance ? Should this be using published messages too or service calls ?

Since there is no feedback when using messages (you can't know if somebody heard them and process them), I would be tempted to use service calls instead.

Thanks in advance for any advice. Best regards. Eric

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-01-12 17:21:54 -0600

The best choice is going to depend on your particular application.

A few rules of thumb:

  • If you need to guarantee that the other node got the message, use a service
  • If you need a response, use a service (or an action)
  • If you need speed, use a topic
  • If you don't care if every message goes through, use a topic
  • If you are interacting with some existing topic/service API, use whatever that API already uses

Note that it also doesn't have to be one or the other. Some nodes (such as move_base) provide both a topic and action API for the same thing.

edit flag offensive delete link more

Comments

Thanks Dan for you quick reply. You confirm what I had concluded from studying existing material. The very last point was also something I had in mind. Regards.

epascual gravatar imageepascual ( 2015-01-13 01:18:24 -0600 )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: 2015-01-12 15:19:52 -0600

Seen: 94 times

Last updated: Jan 12 '15