FKIE Message Filters
Improved filters for processing ROS messages
|
Base class for ROS publishers in a filter pipeline. More...
#include <fkie_message_filters/publisher_base.hpp>
Public Member Functions | |
virtual bool | is_active () const =0 |
Check if the publisher is active. | |
virtual std::string | topic () const =0 |
Return advertised topic name. | |
Protected Member Functions | |
std::tuple< Connection, Connection > | link_with_subscriber (SubscriberBase &sub) |
Add a new subscriber that will be controlled by this publisher. | |
void | shutdown_monitor () noexcept |
Shutdown monitoring thread for the number of subscribers. | |
void | start_monitor (const rclcpp::Node::SharedPtr &node) noexcept |
Start monitoring thread for the number of subscribers. | |
void | update_subscriber_state () |
Cause all linked subscribers to subscribe or unsubscribe to their ROS topics. | |
Base class for ROS publishers in a filter pipeline.
ROS subscribers and publishers can act as sources and sinks in the message filter library. This class provides some basic functionality for on-demand subscriptions.
Check if the publisher is active.
Returns true
if the number of subscribers is greater than zero. The result of the function is used to subscribe or unsubscribe linked subscribers on demand.
Implemented in fkie_message_filters::CameraPublisher< Translate >, fkie_message_filters::ImagePublisher< Translate >, and fkie_message_filters::Publisher< M, Translate >.
|
protected |
Add a new subscriber that will be controlled by this publisher.
sub
the subscriber
|
protectednoexcept |
Shutdown monitoring thread for the number of subscribers.
This function is called automatically when the publisher object is destroyed.
|
protectednoexcept |
Start monitoring thread for the number of subscribers.
This is needed in ROS 2 because there is no longer a dedicated callback for created publishers.
|
pure virtual |
Return advertised topic name.
Implemented in fkie_message_filters::CameraPublisher< Translate >, fkie_message_filters::ImagePublisher< Translate >, and fkie_message_filters::Publisher< M, Translate >.
|
protected |
Cause all linked subscribers to subscribe or unsubscribe to their ROS topics.
This will check the return value of is_active() to determine if the publisher is active, and then call SubscriberBase::subscribe_impl() or SubscriberBase::unsubscribe_impl() accordingly.