ros2actionclient
Description
Use the ros2actionclient
object to connect to an action server
and request the execution of action goals. You can send multiple goals from an action client,
get feedback on the execution progress, and cancel goals at any time.
Creation
Syntax
Description
creates a client for the ROS 2 action with name client
= ros2actionclient(node
,actionname
,actiontype
)actionname
and type
actiontype
. It attaches the action client to the ROS 2 node
specified by the ros2node
object,
node
. If the action server offering
actionname
is not available, the function does not display an
error.
sets the rest of the properties based on the additional options specified by one or more
client
= ros2actionclient(node
,actionname
,actiontype
,Name=Value)Name=Value
pair arguments.
[
returns a goal message initialized with default values for the action type of the
client, using any of the arguments from the previous syntaxes. You can use this message
to modify the goal and send it to the action server.client
,goalMsg
] = ros2actionclient(___)
Properties
Object Functions
ros2message | Create ROS 2 message structures |
waitForServer | Wait for ROS 2 action server to be ready for sending goals |
sendGoal | Send goal message to ROS 2 action server |
getStatus | Get execution status of specific goal sent by ROS 2 action client |
getResult | Get result of specific goal associated with goal handle |
cancelGoal | Cancel specific goal sent by ROS 2 action client |
cancelGoalAndWait | Cancel specific goal sent by ROS 2 action client and wait for cancel response |
cancelGoalsBefore | Cancel goals sent by ROS 2 action client before timestamp |
cancelGoalsBeforeAndWait | Cancel goals sent by ROS 2 action client before timestamp and wait for cancel response |
cancelAllGoals | Cancel all active goals sent by ROS 2 action client |
cancelAllGoalsAndWait | Cancel all active goals sent by ROS 2 action client and wait for cancel response |
Examples
Limitations
If a ROS 2 action server and the action clients connected to it are running in the same MATLAB® session, the server cannot process cancel requests from the client.
MATLAB Compiler™ software do not support ROS custom messages and the
ros2genmsg
function.
Extended Capabilities
Version History
Introduced in R2023a
See Also
ros2actionserver
| sendGoal
| getResult
| getStatus
| cancelGoal
| waitForServer