Function rmw_create_publisher

Function Documentation

rmw_publisher_t *rmw_create_publisher(const rmw_node_t *node, const rosidl_message_type_support_t *type_support, const char *topic_name, const rmw_qos_profile_t *qos_profile, const rmw_publisher_options_t *publisher_options)

Create a publisher and return a handle to that publisher.

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()

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

  • publisher_options is not a valid non-null option set, as returned by rmw_get_default_publisher_options()

  • memory allocation fails during publisher 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 publisher

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

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

  • qos_profile[in] QoS policies for this publisher

  • publisher_options[in] Options to configure this publisher

Returns:

rmw publisher handle, or NULL if there was an error