Class: ActionClient

ActionClient(node, typeClass, actionName, options)

- ROS Action client.

Constructor

new ActionClient(node, typeClass, actionName, options)

Creates a new action client.
Parameters:
Name Type Description
node Node The ROS node to add the action client to.
typeClass function | string | object Type of the action.
actionName string Name of the action.
options object Action client options.
Properties
Name Type Description
enableTypedArray boolean The topic will use TypedArray if necessary, default: true.
qos object ROS Middleware "quality of service" options.
Properties
Name Type Description
goalServiceQosProfile QoS Quality of service option for the goal service, default: QoS.profileServicesDefault.
resultServiceQosProfile QoS Quality of service option for the result service, default: QoS.profileServicesDefault.
cancelServiceQosProfile QoS Quality of service option for the cancel service, default: QoS.profileServicesDefault..
feedbackSubQosProfile QoS Quality of service option for the feedback subscription, default: new QoS(QoS.HistoryPolicy.RMW_QOS_POLICY_HISTORY_SYSTEM_DEFAULT, 10).
statusSubQosProfile QoS Quality of service option for the status subscription, default: QoS.profileActionStatusDefault.
Source:

Methods

destroy() → {undefined}

Destroy the underlying action client handle.
Source:
Returns:
Type
undefined

isActionServerAvailable() → {boolean}

Check if there is an action server ready to process requests from this client.
Source:
Returns:
True if an action server is ready; otherwise, false.
Type
boolean

sendGoal(goal, feedbackCallback, goalUuid) → {Promise}

Send a goal and wait for the goal ACK asynchronously. Return a Promise object that is resolved with a ClientGoalHandle when receipt of the goal is acknowledged by an action server, see client state transition https://index.ros.org/doc/ros2/Tutorials/Understanding-ROS2-Actions/
Parameters:
Name Type Description
goal object The goal request.
feedbackCallback function Callback function for feedback associated with the goal.
goalUuid object Universally unique identifier for the goal. If None, then a random UUID is generated.
Source:
Returns:
- A Promise to a goal handle that resolves when the goal request has been accepted or rejected.
Type
Promise

(async) waitForServer(timeout) → {Promise.<boolean>}

Wait until the action server is available or a timeout is reached. This function polls for the server state so it may not return as soon as the server is available.
Parameters:
Name Type Description
timeout number The maximum amount of time to wait for, if timeout is `undefined` or `< 0`, this will wait indefinitely.
Source:
Returns:
true if the service is available.
Type
Promise.<boolean>