Function rmw_create_service

Function Documentation

rmw_service_t *rmw_create_service(const rmw_node_t *node, const rosidl_service_type_support_t *type_support, const char *service_name, const rmw_qos_profile_t *qos_profile)

Create a service server that can receive requests from and send replies to a service client.

This function can fail, and therefore return NULL, if:

  • node is NULL, or

  • node does not belong to this implementation i.e. it does not have a matching implementation identifier, or

  • type_support is NULL, or

  • service_name is NULL, or

  • service_name is an empty string, or

  • (if ROS namespace conventions apply) service_name is invalid by rmw_validate_full_topic_name() definition, or

  • qos_profile is NULL, or

  • qos_profile has invalid or unknown policies, or

  • memory allocation fails during service server creation, or

  • an unspecified error occurs

Attribute

Adherence

Allocates Memory

Yes

Thread-Safe

No

Uses Atomics

Maybe [1]

Lock-Free

Maybe [1]

[1] rmw implementation defined, check the implementation documentation

Parameters:
  • node[in] Node with which to register this service server.

  • type_support[in] Type support of the service to be served.

  • service_name[in] Name of the service to be served, often a fully qualified service name unless qos_profile is configured to avoid ROS namespace conventions i.e. to create a native service server.

  • qos_profile[in] QoS policies for this service server’s connections.

Pre:

Given node must be a valid node, as returned by rmw_create_node().

Pre:

Given type_support must be a valid rosidl service type support, as returned by ROSIDL_GET_SRV_TYPE_SUPPORT().

Returns:

rmw service handle, or NULL if there was an error.