Function rmw_create_subscription

Function Documentation

rmw_subscription_t *rmw_create_subscription(const rmw_node_t *node, const rosidl_message_type_support_t *type_support, const char *topic_name, const rmw_qos_profile_t *qos_policies, const rmw_subscription_options_t *subscription_options)

Create a subscription and return a handle to that subscription.

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

  • node is not a valid non-null handle for this rmw implementation, as returned by rmw_create_node()

  • type_support is a not valid non-null message type support, as returned by ROSIDL_GET_MSG_TYPE_SUPPORT()

  • topic_name is not a valid non-null topic name, according to rmw_validate_full_topic_name() if ROS namespace conventions apply

  • qos_profile is not a fully specified non-null profile i.e. no UNKNOWN policies

  • subscription_options is not a valid non-null option set, such as the one returned by rmw_get_default_subscription_options()

  • memory allocation fails during subscription creation

  • 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] Handle to node with which to register this subscription

  • type_support[in] Type support for the messages to be subscribed to

  • topic_name[in] Name of the topic to subscribe to, often a fully qualified topic name unless qos_profile is configured to avoid ROS namespace conventions i.e. to create a native topic subscription

  • qos_policies[in] QoS policies for this subscription

  • subscription_options[in] Options for configuring this subscription

Returns:

rmw subscription handle, or NULL if there was an error