rclcpp
master
C++ ROS Client Library API
|
A publisher publishes messages of any type to a topic. More...
#include <publisher.hpp>
Public Types | |
using | MessageAllocTraits = allocator::AllocRebind< MessageT, Alloc > |
using | MessageAlloc = typename MessageAllocTraits::allocator_type |
using | MessageDeleter = allocator::Deleter< MessageAlloc, MessageT > |
using | MessageUniquePtr = std::unique_ptr< MessageT, MessageDeleter > |
Public Types inherited from rclcpp::PublisherBase | |
using | StoreMessageCallbackT = std::function< uint64_t(uint64_t, void *, const std::type_info &)> |
Public Member Functions | |
Publisher (rclcpp::node_interfaces::NodeBaseInterface *node_base, const std::string &topic, const rcl_publisher_options_t &publisher_options, const std::shared_ptr< MessageAlloc > &allocator) | |
virtual | ~Publisher () |
virtual void | publish (std::unique_ptr< MessageT, MessageDeleter > &msg) |
Send a message to the topic for this publisher. More... | |
virtual void | publish (const std::shared_ptr< MessageT > &msg) |
virtual void | publish (std::shared_ptr< const MessageT > msg) |
virtual void | publish (const MessageT &msg) |
virtual void | publish (const MessageT *msg) |
void | publish (const rcl_serialized_message_t *serialized_msg) |
void | publish (std::shared_ptr< const rcl_serialized_message_t > serialized_msg) |
std::shared_ptr< MessageAlloc > | get_allocator () const |
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... | |
const rmw_gid_t & | get_intra_process_gid () const |
Get the global identifier for this publisher used by intra-process communication. More... | |
rcl_publisher_t * | get_publisher_handle () |
Get the rcl publisher handle. More... | |
const rcl_publisher_t * | get_publisher_handle () const |
Get the rcl publisher handle. 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, StoreMessageCallbackT callback, const rcl_publisher_options_t &intra_process_options) |
Implementation utility function used to setup intra process publishing after creation. More... | |
Protected Member Functions | |
void | do_inter_process_publish (const MessageT *msg) |
A publisher publishes messages of any type to a topic.
using rclcpp::Publisher< MessageT, Alloc >::MessageAllocTraits = allocator::AllocRebind<MessageT, Alloc> |
using rclcpp::Publisher< MessageT, Alloc >::MessageAlloc = typename MessageAllocTraits::allocator_type |
using rclcpp::Publisher< MessageT, Alloc >::MessageDeleter = allocator::Deleter<MessageAlloc, MessageT> |
using rclcpp::Publisher< MessageT, Alloc >::MessageUniquePtr = std::unique_ptr<MessageT, MessageDeleter> |
|
inline |
|
inlinevirtual |
|
inlinevirtual |
Send a message to the topic for this publisher.
This function is templated on the input message type, MessageT.
[in] | msg | A shared pointer to the message to send. |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
|
protected |
|
protected |