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

what's the differences between action and services?

asked 2016-05-11 03:54:11 -0600

WuJeff gravatar image

Now,I have learnt action 's related tutorials including creation of client and server,Also learnt services including serviceClient and serviceServer,now I want to know their differences,It seems that I can implement same functions that I need with the two methods,please tell me when and where to use them?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
3

answered 2016-05-11 07:13:56 -0600

lfr gravatar image

The main difference is that action (using actionlib package) allows to preempt a running task contrary to service which will continue the task until the end. Action is useful when you have to observe real-time constraints.

edit flag offensive delete link more

Comments

You can also have a feedback every times with actions as Jbot well said

lfr gravatar image lfr  ( 2016-05-11 07:16:11 -0600 )edit
3

answered 2016-05-11 04:13:27 -0600

Jbot gravatar image

The main difference is the possibility to have a feedback when using action. When you use service, you can only have a result at the end of the service.

For example, you make a service and an action "goToPoint" :

  • The service will answer you at the end if you have reached the desired point
  • The action will send you every X milliseconds how many meters remain to do to arrive to the desired point
edit flag offensive delete link more

Comments

thanks very much

WuJeff gravatar image WuJeff  ( 2016-05-11 04:59:46 -0600 )edit
3

No, that is not the main difference, but rather a manifestation of the crucial distinction: service calls block, actionlibs are non-blocking.

kramer gravatar image kramer  ( 2016-05-11 07:06:48 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-05-11 03:54:11 -0600

Seen: 3,432 times

Last updated: May 11 '16