nros C API
Lightweight ROS 2 client for embedded real-time systems
Loading...
Searching...
No Matches
Functions
publisher.h File Reference

Topic publisher API. More...

#include "rclc/types.h"
#include "rclc/rclc.h"
Include dependency graph for publisher.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static rcl_ret_t rclc_publisher_init_best_effort (struct rcl_publisher_t *publisher, const struct rcl_node_t *node, const struct rclc_message_type_t *type_info, const char *topic_name)
 rclc's best-effort preset constructor for a publisher.
 

Detailed Description

Topic publisher API.

Create publishers with rclc_publisher_init_default() and publish serialised messages with rclc_publish_raw().

Function Documentation

◆ rclc_publisher_init_best_effort()

static rcl_ret_t rclc_publisher_init_best_effort ( struct rcl_publisher_t *  publisher,
const struct rcl_node_t *  node,
const struct rclc_message_type_t *  type_info,
const char *  topic_name 
)
inlinestatic

rclc's best-effort preset constructor for a publisher.

phase-417 W5.d. rclc ships one named entry point per QoS preset (_default, _best_effort) and nano-ros ships the QoS-taking form rclc_publisher_init_with_qos(). Ledger row c:publisher_init_best_effort filed that as a divergence on the argument that "a named function per preset does not scale past the two rclc chose" — which is a reason not to GROW the family, not a reason to leave the two rclc actually ships unported. RFC-0089's rule points the other way: a ported rclc file writes this line, so it must compile and mean the same thing.

What rclc means by it, read from rclc's own source (rclc/src/rclc/ publisher.c @ 10eadcc): rclc_publisher_init(..., &rmw_qos_profile_sensor_data) — best-effort, volatile, KEEP_LAST(5). Not "the default profile with reliability flipped": the DEPTH changes too, from 10 to 5. RCLC_QOS_SENSOR_DATA is our mirror of that profile, so this forwards to it by name rather than restating nine fields (issue 0160's hand-mirror class).

A static inline rather than an exported symbol, for the same reason rcl_difference_times() is one: no state sits behind it and nothing is computed here that is not already an entry point. It adds no symbol to the link and no writable data to the image.

The typesupport parameter keeps OUR type, and the envelope is inherited whole from rclc_publisher_init_with_qos() — including that neither namespace expansion nor remap is applied (see ledger row c:publisher_init). This forwarder is exactly as faithful as rclc_publisher_init_default beside it, and no more.

Parameters
[out]publisherZero-initialised publisher to fill in.
[in]nodeAn initialised node.
[in]type_infoGenerated message type descriptor.
[in]topic_nameTopic name, null-terminated.
Returns
Whatever rclc_publisher_init_with_qos() returns.