Constructor
new ActionServer(node, typeClass, actionName, executeCallback, goalCallback, handleAcceptedCallback, cancelCallback, options)
Creates a new action server.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
node |
Node | The ROS node to add the action server to. | ||||||||||||||||||||||||||||||
typeClass |
function | string | object | Type of the action. | ||||||||||||||||||||||||||||||
actionName |
string | Name of the action. Used as part of the underlying topic and service names. | ||||||||||||||||||||||||||||||
executeCallback |
function | Callback function for processing accepted goals. | ||||||||||||||||||||||||||||||
goalCallback |
function | Callback function for handling new goal requests. | ||||||||||||||||||||||||||||||
handleAcceptedCallback |
function | Callback function for handling newly accepted goals. | ||||||||||||||||||||||||||||||
cancelCallback |
function | Callback function for handling cancel requests. | ||||||||||||||||||||||||||||||
options |
object | Action server options.
Properties
|
- Source:
Methods
destroy() → {undefined}
Destroy the action server and all goals.
- Source:
Returns:
- Type
- undefined
registerCancelCallback(cancelCallback) → {undefined}
Register a callback for handling cancel requests.
The purpose of the cancel callback is to decide if a request to cancel an on-going
(or queued) goal should be accepted or rejected.
The callback should take one parameter containing the cancel request and must return a
CancelResponse value.
There can only be one cancel callback per ActionServer, therefore calling this
function will replace any previously registered callback.
Parameters:
Name | Type | Description |
---|---|---|
cancelCallback |
function | Callback function, if not provided, then unregisters any previously registered callback. |
- Source:
Returns:
- Type
- undefined
registerExecuteCallback(executeCallback) → {undefined}
Register a callback for executing action goals.
The purpose of the execute callback is to execute the action goal and return a result when finished.
The callback should take one parameter containing goal request and must return a
result instance (i.e. `action_type.Result`).
There can only be one execute callback per ActionServer, therefore calling this
function will replace any previously registered callback.
Parameters:
Name | Type | Description |
---|---|---|
executeCallback |
function | Callback function. |
- Source:
Returns:
- Type
- undefined
registerGoalCallback(goalCallback) → {undefined}
Register a callback for handling new goal requests.
The purpose of the goal callback is to decide if a new goal should be accepted or rejected.
The callback should take the goal request message as a parameter and must return a GoalResponse value.
Parameters:
Name | Type | Description |
---|---|---|
goalCallback |
function | Callback function, if not provided, then unregisters any previously registered callback. |
- Source:
Returns:
- Type
- undefined
registerHandleAcceptedCallback(handleAcceptedCallback) → {undefined}
Register a callback for handling newly accepted goals.
The provided function is called whenever a new goal has been accepted by this action server.
The function should expect an instance of ServerGoalHandle as an argument,
which represents a handle to the goal that was accepted.
The goal handle can be used to interact with the goal, e.g. publish feedback,
update the status, or execute a deferred goal.
There can only be one handle accepted callback per ActionServer,
therefore calling this function will replace any previously registered callback.
Parameters:
Name | Type | Description |
---|---|---|
handleAcceptedCallback |
function | Callback function, if not provided, then unregisters any previously registered callback. |
- Source:
Returns:
- Type
- undefined