Receive Service Request
Libraries:
ROS Toolbox /
ROS 2
Description
The Receive Service Request block enables you to receive a ROS 2 service request message from a service client, process it in the model to construct an appropriate response, and then send the response to the client using a Send Service Response block. Thus, you can use the Receive Service Request and Send Service Response blocks in the same model to implement a ROS 2 service server in Simulink®. The service server is associated with the node of the Simulink model.
On each simulation step, the Receive Service Request block checks if a new service request has been sent by a client. If a new service request is available, the block retrieves it and outputs a non-virtual bus which corresponds to the service request message type. If the block does not receive a service request at a time step, it outputs the last service request message received.
Specify the name for your ROS 2 service, the service type, and the quality of service (QoS) parameters in the block mask. QoS parameters for this block must be compatible with the service clients to receive requests and send responses.
Note
For each Receive Service Request you add to a model, you must click Click to create paired Send Response block in the block mask to create a paired Send Service Response block. Do not add a Send Service Response block from the library.
Examples
Ports
Output
Parameters
Extended Capabilities
Version History
Introduced in R2024a