Publish consumed data to a ROS image topic. More...
#include <image_publisher.h>
Public Member Functions | |
void | advertise (const image_transport::ImageTransport &it, const std::string &base_topic, uint32_t queue_size, bool latch=false) noexcept |
Advertise ROS image topic. More... | |
void | advertise (const image_transport::ImageTransport &it, const std::string &base_topic, uint32_t queue_size, const image_transport::SubscriberStatusCallback &connect_cb, const image_transport::SubscriberStatusCallback &disconnect_cb=image_transport::SubscriberStatusCallback(), const ros::VoidPtr &tracked_object=ros::VoidPtr(), bool latch=false) noexcept |
Advertise ROS image topic with subscriber status callbacks. More... | |
ImagePublisher () noexcept | |
Constructs an empty publisher. More... | |
ImagePublisher (const image_transport::ImageTransport &it, const std::string &base_topic, uint32_t queue_size, bool latch=false) noexcept | |
Constructor that advertises the given ROS image topic. More... | |
virtual bool | is_active () const noexcept override |
Check if the ROS publisher has at least one subscriber. More... | |
virtual std::string | topic () const noexcept override |
Return the configured ROS topic. More... | |
Private Member Functions | |
void | receive (const sensor_msgs::ImageConstPtr &) noexcept override |
Private Attributes | |
std::shared_ptr< image_transport::ImageTransport > | it_ |
image_transport::Publisher | pub_ |
Additional Inherited Members |
Publish consumed data to a ROS image topic.
This is a specialized publisher that uses image_transport to publish to a ROS image topic. All messages which are received from the connected sources will be published on the advertised ROS topic.
Unlike regular ROS publishers, this class can be associated with one or more subscriber instances. In that case, the subscribers will subscribe to their ROS topics only if the publisher is actively used. This is a convenient method to save processing power if the filter pipeline is used only intermittently.
Definition at line 60 of file image_publisher.h.
|
inlinenoexcept |
Constructs an empty publisher.
You need to call advertise() to actually publish to a ROS topic.
\nothrow
Definition at line 87 of file image_publisher.h.
|
noexcept |
Constructor that advertises the given ROS image topic.
The constructor calls advertise() for you.
\nothrow
Definition at line 44 of file image_publisher.cpp.
|
noexcept |
Advertise ROS image topic.
All arguments are passed to the ROS client library; see the ROS documentation for further information. Calling this method will automatically unadvertise any previously advertised ROS topic.
it
ROS image_transport instance to handle the publishing base_topic
name of the ROS image topic, subject to remapping queue_size
size of the ROS publishing queue latch
if true, the last published message remains available for later subscribers\nothrow
Definition at line 59 of file image_publisher.cpp.
|
noexcept |
Advertise ROS image topic with subscriber status callbacks.
All arguments are passed to the ROS client library; see the ROS documentation for further information. Calling this method will automatically unadvertise any previously advertised ROS topic.
it
ROS image_transport instance to handle the publishing base_topic
name of the ROS image topic, subject to remapping queue_size
size of the ROS publishing queue connect_cb
callback that is invoked each time a new subscriber connects to the advertised topic disconnect_cb
callback that is invoked each time an existing subscriber disconnects from the advertised topic tracked_object
an associated object whose lifetime will limit the lifetime of the advertised topic latch
if true, the last published message remains available for later subscribers\nothrow
Definition at line 78 of file image_publisher.cpp.
|
overridevirtualnoexcept |
Check if the ROS publisher has at least one subscriber.
\nothrow
Implements fkie_message_filters::PublisherBase.
Definition at line 49 of file image_publisher.cpp.
|
overrideprivatenoexcept |
Definition at line 99 of file image_publisher.cpp.
|
overridevirtualnoexcept |
Return the configured ROS topic.
\nothrow
Implements fkie_message_filters::PublisherBase.
Definition at line 54 of file image_publisher.cpp.
|
private |
Definition at line 139 of file image_publisher.h.
|
private |
Definition at line 140 of file image_publisher.h.