Class PublisherBase
Defined in File publisher_base.hpp
Inheritance Relationships
Derived Types
public fkie_message_filters::CameraPublisher< Translate >(Template Class CameraPublisher)public fkie_message_filters::ImagePublisher< Translate >(Template Class ImagePublisher)public fkie_message_filters::Publisher< M, Translate, A >(Template Class Publisher)
Class Documentation
-
class PublisherBase
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.
See also
Subclassed by fkie_message_filters::CameraPublisher< Translate >, fkie_message_filters::ImagePublisher< Translate >, fkie_message_filters::Publisher< M, Translate, A >
Public Functions
-
virtual ~PublisherBase()
-
virtual bool is_active() const = 0
Check if the publisher is active.
Returns
trueif the number of subscribers is greater than zero. The result of the function is used to subscribe or unsubscribe linked subscribers on demand.Does not throw any exceptions.
- template<class NodeT, typename std::enable_if_t< !std::is_convertible_v< NodeT, rclcpp::node_interfaces::NodeGraphInterface::SharedPtr >, bool >> FKIE_MF_BEGIN_ABI_NAMESPACE void start_monitor (NodeT &&node) noexcept
-
virtual std::string topic() const = 0
Return advertised topic name.
Depends on the implementation.
Protected Functions
-
std::tuple<Connection, Connection> link_with_subscriber(SubscriberBase &sub)
Add a new subscriber that will be controlled by this publisher.
subthe subscriberPropagates exceptions raised by the implementation of the abstract class methods.
- Returns:
two connection objects for the signal to enable and disable the linked subscriber
-
void shutdown_monitor() noexcept
Shutdown monitoring thread for the number of subscribers.
This function is called automatically when the publisher object is destroyed.
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.
Does not throw any exceptions.
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.
-
void update_subscriber_state()
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.
Propagates exceptions raised by the implementation of the abstract class methods.
-
virtual ~PublisherBase()