You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/051_actions.md
+23-74Lines changed: 23 additions & 74 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,30 +20,15 @@ Original Author: {{ page.author }}
20
20
21
21
## Background
22
22
23
-
ROS services, which provide synchronous Remote Procedure Calls, are a useful
24
-
concept for sending a request and getting a rapid reply. But in robotics there
25
-
are many instances where a reply may take a significant length of time.
26
-
Additionally, there are occasions when it is useful to send a request to
27
-
do some processing or perform some action in the world, where the result is
28
-
less important than the effect of carrying it out. The progress of such
29
-
requests often needs to be tracked, success or failure must be known in
30
-
addition to receiving back information produced, and the request may need to be
31
-
cancelled or altered before it completes. These requirements cannot be
32
-
fulfilled by a simple RPC mechanism, whether or not it is asynchronous.
33
-
34
-
To satisfy these use cases, ROS provides a third communication paradigm known
35
-
as "actions". An action is a goal-oriented request that occurs asynchronously
36
-
to the requester, is typically (but not necessarily) longer-running than
37
-
immediate, can be cancelled or replaced during execution, and has a server that
38
-
provides feedback on execution progress.
39
-
40
-
This document defines how actions are specified, what they look like to ROS
41
-
users (both node developers and system integrators)
23
+
ROS services, which provide synchronous Remote Procedure Calls, are a useful concept for sending a request and getting a rapid reply. But in robotics there are many instances where a reply may take a significant length of time. Additionally, there are occasions when it is useful to send a request to do some processing or perform some action in the world, where the result is less important than the effect of carrying it out. The progress of such requests often needs to be tracked, success or failure must be known in addition to receiving back information produced, and the request may need to be cancelled or altered before it completes. These requirements cannot be fulfilled by a simple RPC mechanism, whether or not it is asynchronous.
24
+
25
+
To satisfy these use cases, ROS provides a third communication paradigm known as "actions". An action is a goal-oriented request that occurs asynchronously to the requester, is typically (but not necessarily) longer-running than immediate, can be cancelled or replaced during execution, and has a server that provides feedback on execution progress.
26
+
27
+
This document defines how actions are specified, what they look like to ROS users (both node developers and system integrators)
42
28
43
29
## Action specification
44
30
45
-
Actions are specified using a form of the ROS Message IDL. The specification
46
-
contains three sections, each of which is a message specification:
31
+
Actions are specified using a form of the ROS Message IDL. The specification contains three sections, each of which is a message specification:
47
32
48
33
1. Goal
49
34
@@ -55,8 +40,7 @@ Any of these sections may be empty.
55
40
56
41
Between the three sections is a line containing three hyphens, `---`.
57
42
58
-
Action specifications are stored in a file ending in `.action`. There is one
59
-
action specification per `.action` file.
43
+
Action specifications are stored in a file ending in `.action`. There is one action specification per `.action` file.
60
44
61
45
An example action specification [taken from the actionlib wiki] is shown below.
62
46
@@ -74,73 +58,38 @@ uint32 number_dishes_cleaned
74
58
75
59
## Serving and using actions
76
60
77
-
Actions are a first-class citizen in the ROS API, alongside topics and
78
-
services.
79
-
80
-
Action clients will use an API that provides a proxy object for the action.
81
-
This will be a templated class, using the action class generated from the
82
-
action specification as the template parameter. The client shall create an
83
-
instance of this class, providing the address of the intended action server.
84
-
Each instance of this class can only be related to one action server. Methods
85
-
of the class will provide facilities for sending a goal to the action server,
86
-
receiving a result, and getting feedback.
87
-
88
-
Action servers will use an API that provides a templated server class, using
89
-
the action class generated from the action specification as the template
90
-
parameter. The node implementer will create a function that implements the
91
-
action's behaviour, create an instance of the templated server class, and bind
92
-
the implementing function to the server. The implementing function will receive
93
-
as one of its parameters the received goal message, and as another parameter
94
-
the action server instance. The implementation shall use the action server
95
-
instance to provide progress feedback and to report the result and
96
-
success/failure/error status of the action's execution.
97
-
98
-
Actions may be used from or served by real-time nodes. Therefore the actions
99
-
API must be real-time capable.
61
+
Actions are a first-class citizen in the ROS API, alongside topics and services.
62
+
63
+
Action clients will use an API that provides a proxy object for the action. This will be a templated class, using the action class generated from the action specification as the template parameter. The client shall create an instance of this class, providing the address of the intended action server. Each instance of this class can only be related to one action server. Methods of the class will provide facilities for sending a goal to the action server, receiving a result, and getting feedback.
64
+
65
+
Action servers will use an API that provides a templated server class, using the action class generated from the action specification as the template parameter. The node implementer will create a function that implements the action's behaviour, create an instance of the templated server class, and bind the implementing function to the server. The implementing function will receive as one of its parameters the received goal message, and as another parameter the action server instance. The implementation shall use the action server instance to provide progress feedback and to report the result and success/failure/error status of the action's execution.
66
+
67
+
Actions may be used from or served by real-time nodes. Therefore the actions API must be real-time capable.
100
68
101
69
## Introspection tools
102
70
103
71
Actions, like topics and services, are introspectable from the command line.
104
72
105
73
In ROS 1, actions are visible in the output of the `rostopic` tool.
106
74
107
-
In ROS 2, actions will not be visible as a set of topics. Nor will they be
108
-
visible as a set of services [in the case that services be used to implement
109
-
them]. They will be visible using a separate `ros2 action` command line tool.
75
+
In ROS 2, actions will not be visible as a set of topics. Nor will they be visible as a set of services [in the case that services be used to implement them]. They will be visible using a separate `ros2 action` command line tool.
110
76
111
-
The command line tool will be similar to the `ros2 service` tool. It will be
112
-
able to:
77
+
The command line tool will be similar to the `ros2 service` tool. It will be able to:
113
78
114
79
- list known actions,
115
80
- display the arguments for an action's goal,
116
81
- display the type of an action's feedback and result,
117
82
- display information about the server of an action,
118
83
- display the underlying topics and/or services providing the action,
119
84
- find actions by action type, and
120
-
- call an action, display feedback as it is received, display the result when
121
-
received, and cancel the action (when the tool is terminated prematurely)
85
+
- call an action, display feedback as it is received, display the result when received, and cancel the action (when the tool is terminated prematurely)
122
86
123
-
Each action, despite using multiple topics and/or services in its
124
-
implementation, will be listed and treated as a single unit by this tool. [This
125
-
will probably be a namespace that contains the underlying topics, etc.]
87
+
Each action, despite using multiple topics and/or services in its implementation, will be listed and treated as a single unit by this tool. [This will probably be a namespace that contains the underlying topics, etc.]
126
88
127
89
## Middleware implementation
128
90
129
-
In ROS 1, actions are implemented using a set of topics under a namespace taken
130
-
from the action name. This implementation was chosen because ROS services are
131
-
inherently synchronous, and so incompatible with the asynchronous nature of the
132
-
action concept. There is also a need for a status/feedback channel and a
133
-
control channel.
134
-
135
-
The Remote Procedure Call over DDS (DDS-RPC) specification does not explicitly
136
-
provide facilities for interrupting service calls or receiving feedback on
137
-
their progress. It does provide for receiving both a return value from a
138
-
request and, at the same time, an indication of whether the request was
139
-
successful or raised an exception, with the exception type included in this
140
-
information.
141
-
142
-
This means that an implementation of actions cannot simply be a DDS-style RPC.
143
-
The implementation must separately provide status/feedback and control
144
-
channels. While a control channel could be implemented as a separate RPC, due
145
-
to the dataflow nature of feedback it would be best implemented as a separate
146
-
topic.
91
+
In ROS 1, actions are implemented using a set of topics under a namespace taken from the action name. This implementation was chosen because ROS services are inherently synchronous, and so incompatible with the asynchronous nature of the action concept. There is also a need for a status/feedback channel and a control channel.
92
+
93
+
The Remote Procedure Call over DDS (DDS-RPC) specification does not explicitly provide facilities for interrupting service calls or receiving feedback on their progress. It does provide for receiving both a return value from a request and, at the same time, an indication of whether the request was successful or raised an exception, with the exception type included in this information.
94
+
95
+
This means that an implementation of actions cannot simply be a DDS-style RPC. The implementation must separately provide status/feedback and control channels. While a control channel could be implemented as a separate RPC, due to the dataflow nature of feedback it would be best implemented as a separate topic.
0 commit comments