rosactionserver
Description
Use rosactionserver
to create an action server as a
SimpleActionServer
object. Then, use the rosactionclient
object to create an action client and connect to the action server
to request the execution of action goals. When a connected client sends a goal execution
request, the server executes the specified callback function. You can use the rosActionServerExecuteGoalFcn
function to customize the callback function based
on a predefined framework. The server can provide periodic feedback on execution progress to
the clients, and stop goal execution if specified or if a new goal is received.
When you create the action server, it registers itself with the ROS
master. To get a list of actions, or to get information about a
particular action that is available on the current ROS network, use the rosaction
function.
An action is defined by a type and three messages: one for the goal, one for the feedback, and one for the result. On receiving a goal, the server goal execution callback must periodically send feedback to the client during goal execution, and return an appropriate result when goal execution completes. The behavior of the action server is inherently asynchronous because it becomes active only when an action client connects to the ROS network and issues a goal execution request.
Creation
Syntax
Description
creates an action server object, server
= rosactionserver(actionname
,actiontype
,ExecuteGoalFcn
=cb)server
, that corresponds to the
ROS action of the specified name, actionname
and type,
actiontype
. You must also specify the
ExecuteGoalFcn
property as a function handle callback,
cb
, which handles the goal execution when the client sends a
request.
[
specifies to use message structures instead of objects, in addition to all input
arguments from the previous syntax. For more information, see Improve Performance of ROS Using Message Structures.server
]
= rosactionserver(___,"DataFormat","struct")
server = ros.SimpleActionServer(
attaches the created action server to the specified ROS node
node
, actionname
,actiontype
,ExecuteGoalFcn
=cb)node
.
[
uses message structures instead of objects. For more information, see Improve Performance of ROS Using Message Structures.server
]
= ros.SimpleActionServer(___,DataFormat="struct")
Properties
Object Functions
getFeedbackMessage | Create new action feedback message |
isPreemeptRequested | Check if a goal has been preempted |
sendFeedback | Send feedback to action client during goal execution |
Examples
Extended Capabilities
Version History
Introduced in R2022a