rclcpp
master
C++ ROS Client Library API
|
Publisher for serialized messages whose type is not known at compile time. More...
#include <generic_publisher.hpp>
Public Member Functions | |
template<typename AllocatorT = std::allocator<void>> | |
GenericPublisher (rclcpp::node_interfaces::NodeBaseInterface *node_base, std::shared_ptr< rcpputils::SharedLibrary > ts_lib, const std::string &topic_name, const std::string &topic_type, const rclcpp::QoS &qos, const rclcpp::PublisherOptionsWithAllocator< AllocatorT > &options) | |
Constructor. More... | |
virtual | ~GenericPublisher ()=default |
void | publish (const rclcpp::SerializedMessage &message) |
Publish a rclcpp::SerializedMessage. More... | |
Public Member Functions inherited from rclcpp::PublisherBase | |
PublisherBase (rclcpp::node_interfaces::NodeBaseInterface *node_base, const std::string &topic, const rosidl_message_type_support_t &type_support, const rcl_publisher_options_t &publisher_options) | |
Default constructor. More... | |
virtual | ~PublisherBase () |
const char * | get_topic_name () const |
Get the topic that this publisher publishes on. More... | |
size_t | get_queue_size () const |
Get the queue size for this publisher. More... | |
const rmw_gid_t & | get_gid () const |
Get the global identifier for this publisher (used in rmw and by DDS). More... | |
std::shared_ptr< rcl_publisher_t > | get_publisher_handle () |
Get the rcl publisher handle. More... | |
std::shared_ptr< const rcl_publisher_t > | get_publisher_handle () const |
Get the rcl publisher handle. More... | |
const std::vector< std::shared_ptr< rclcpp::QOSEventHandlerBase > > & | get_event_handlers () const |
Get all the QoS event handlers associated with this publisher. More... | |
size_t | get_subscription_count () const |
Get subscription count. More... | |
size_t | get_intra_process_subscription_count () const |
Get intraprocess subscription count. More... | |
RCUTILS_WARN_UNUSED bool | assert_liveliness () const |
Manually assert that this Publisher is alive (for RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_TOPIC). More... | |
rclcpp::QoS | get_actual_qos () const |
Get the actual QoS settings, after the defaults have been determined. More... | |
bool | can_loan_messages () const |
Check if publisher instance can loan messages. More... | |
bool | operator== (const rmw_gid_t &gid) const |
Compare this publisher to a gid. More... | |
bool | operator== (const rmw_gid_t *gid) const |
Compare this publisher to a pointer gid. More... | |
void | setup_intra_process (uint64_t intra_process_publisher_id, IntraProcessManagerSharedPtr ipm) |
Implementation utility function used to setup intra process publishing after creation. More... | |
std::vector< rclcpp::NetworkFlowEndpoint > | get_network_flow_endpoints () const |
Get network flow endpoints. More... | |
Public Member Functions inherited from std::enable_shared_from_this< PublisherBase > | |
T | enable_shared_from_this (T... args) |
T | operator= (T... args) |
T | shared_from_this (T... args) |
T | ~enable_shared_from_this (T... args) |
Additional Inherited Members | |
Public Types inherited from rclcpp::PublisherBase | |
using | IntraProcessManagerSharedPtr = std::shared_ptr< rclcpp::experimental::IntraProcessManager > |
Protected Types inherited from rclcpp::PublisherBase | |
using | IntraProcessManagerWeakPtr = std::weak_ptr< rclcpp::experimental::IntraProcessManager > |
Protected Member Functions inherited from rclcpp::PublisherBase | |
template<typename EventCallbackT > | |
void | add_event_handler (const EventCallbackT &callback, const rcl_publisher_event_type_t event_type) |
void | default_incompatible_qos_callback (QOSOfferedIncompatibleQoSInfo &info) const |
Protected Attributes inherited from rclcpp::PublisherBase | |
std::shared_ptr< rcl_node_t > | rcl_node_handle_ |
std::shared_ptr< rcl_publisher_t > | publisher_handle_ |
std::vector< std::shared_ptr< rclcpp::QOSEventHandlerBase > > | event_handlers_ |
bool | intra_process_is_enabled_ |
IntraProcessManagerWeakPtr | weak_ipm_ |
uint64_t | intra_process_publisher_id_ |
rmw_gid_t | rmw_gid_ |
Publisher for serialized messages whose type is not known at compile time.
Since the type is not known at compile time, this is not a template, and the dynamic library containing type support information has to be identified and loaded based on the type name.
It does not support intra-process handling.
|
inline |
Constructor.
In order to properly publish to a topic, this publisher needs to be added to the node_topic_interface of the node passed into this constructor.
node_base | Pointer to parent node's NodeBaseInterface |
ts_lib | Type support library, needs to correspond to topic_type |
topic_name | Topic name |
topic_type | Topic type |
qos | QoS settings |
callback | Callback for new messages of serialized form |
options | Publisher options. Not all publisher options are currently respected, the only relevant options for this publisher are event_callbacks , use_default_callbacks , and callback_group . |
|
virtualdefault |
void rclcpp::GenericPublisher::publish | ( | const rclcpp::SerializedMessage & | message | ) |
Publish a rclcpp::SerializedMessage.