Function rmw_send_response
Defined in File rmw.h
Function Documentation
-
rmw_ret_t rmw_send_response(const rmw_service_t *service, rmw_request_id_t *request_header, void *ros_response)
Send a ROS service response.
Send a ROS service response to the service client, with matching QoS policies, from which the previously taken ROS service request was originally sent.
Attribute
Adherence
Allocates Memory
Maybe
Thread-Safe
Yes
Uses Atomics
Maybe [1]
Lock-Free
Maybe [1]
[1] implementation defined, check implementation documentation.
- Runtime behavior
It is implementation defined whether sending a ROS service response is a synchronous or asynchronous, and blocking or non-blocking, operation. However, asynchronous implementations are not allowed to access the given ROS service request after this function returns. Check the implementation documentation to learn about request behavior.
- Memory allocation
It is implementation defined whether memory will be allocated on send or not. For instance, implementations that serialize ROS service responses may need to perform additional memory allocations when dealing with unbounded (dynamically-sized) fields.
- Thread-safety
Service servers are thread-safe objects, and so are all operations on them except for finalization. Therefore, it is safe to send responses using the same service server concurrently. However:
Access to the given ROS service request header is read-only but it is not synchronized. Concurrent
request_headerreads are safe, but concurrent reads and writes are not.Access to the given ROS service response is read-only but it is not synchronized. Concurrent
ros_requestreads are safe, but concurrent reads and writes are not.
- Parameters:
service – [in] Service server to send a response with.
request_header – [in] Service response header, same as the one taken with the corresponding ROS service request.
ros_response – [in] ROS service response to be sent.
- Pre:
Given
servicemust be a valid service server, as returned by rmw_create_service().- Pre:
Given
request_headermust be the one previously taken along with the ROS service request to which we reply.- Pre:
Given
ros_responsemust be a valid service response, whose type matches the service type support registered with theserviceon creation.- Returns:
RMW_RET_OKif successful, or- Returns:
RMW_RET_BAD_ALLOCif memory allocation fails, or- Returns:
RMW_RET_INVALID_ARGUMENTifserviceis NULL, or- Returns:
RMW_RET_INVALID_ARGUMENTifrequest_headeris NULL, or- Returns:
RMW_RET_INVALID_ARGUMENTifros_responseis NULL, or- Returns:
RMW_RET_INCORRECT_RMW_IMPLEMENTATIONif theserviceimplementation identifier does not match this implementation, or- Returns:
RMW_RET_TIMEOUTif a response reader is not ready yet, or- Returns:
RMW_RET_ERRORif an unexpected error occurs.