FKIE Message Filters
Improved filters for processing ROS messages
|
Base class for ROS subscribers in a filter pipeline. More...
#include <fkie_message_filters/subscriber_base.h>
Public Member Functions | |
virtual void | subscribe () |
Subscribe to the configured ROS topic. More... | |
virtual void | subscribe_on_demand (PublisherBase &pub) |
Subscribe to the configured ROS topic whenever the given publisher is active. More... | |
virtual std::string | topic () const =0 |
Return the subscribed topic name. More... | |
virtual void | unsubscribe () |
Unsubscribe from the configured ROS topic. More... | |
Protected Member Functions | |
virtual bool | is_configured () const =0 |
Check if the subscriber is properly configured. More... | |
void | link_with_publisher (PublisherBase &pub) |
Add self to the list of subscribers which are controlled by a publisher. More... | |
virtual void | subscribe_impl ()=0 |
Implement how to subscribe to the configured ROS topic. More... | |
void | unlink_from_publisher () |
Remove self from the list of subscribers which are controlled by a publisher. More... | |
virtual void | unsubscribe_impl ()=0 |
Implement how to unsubscribe from the configured ROS topic. More... | |
Base class for ROS subscribers 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.
|
protectedpure virtual |
Check if the subscriber is properly configured.
This virtual method must be overridden in derived classes.
true | if subscribe_impl() or unsubscribe_impl() may be called and have all the information they need to subscribe or unsubscribe, respectively. |
false | otherwise |
Implemented in fkie_message_filters::Subscriber< M, Translate >, fkie_message_filters::CameraSubscriber, and fkie_message_filters::ImageSubscriber.
|
protected |
Add self to the list of subscribers which are controlled by a publisher.
A subscriber can be linked with one publisher only. Any previously linked publisher is unlinked first.
pub
publisher
|
virtual |
Subscribe to the configured ROS topic.
This method does nothing if no ROS topic was configured or if the subscriber is subscribed already. Cancels the effect of subscribe_on_demand(), i.e. the subscriber will remain subscribed permanently.
|
protectedpure virtual |
Implement how to subscribe to the configured ROS topic.
This virtual method must be overridden in derived classes to actually subscribe to a topic. It should do nothing if it is subscribed to a topic already.
Implemented in fkie_message_filters::Subscriber< M, Translate >, fkie_message_filters::CameraSubscriber, and fkie_message_filters::ImageSubscriber.
|
virtual |
Subscribe to the configured ROS topic whenever the given publisher is active.
This method does nothing if no ROS topic was configured. Otherwise, it will immediately subscribe or unsubscribe depending on the publisher's current state. If the publisher becomes active or inactive, the subscriber's state will update accordingly.
pub
publisher
|
pure virtual |
Return the subscribed topic name.
Implemented in fkie_message_filters::Subscriber< M, Translate >, fkie_message_filters::CameraSubscriber, and fkie_message_filters::ImageSubscriber.
|
protected |
Remove self from the list of subscribers which are controlled by a publisher.
This will not affect the current subscription state. It will only prevent further updates from the previously linked publisher.
|
virtual |
Unsubscribe from the configured ROS topic.
You can call subscribe() afterwards to re-subscribe to the ROS topic. This method does nothing if the subscriber is not subscribed to any ROS topic. Cancels the effect of subscribe_on_demand(), i.e. the subscriber will remain unsubscribed permanently.
|
protectedpure virtual |
Implement how to unsubscribe from the configured ROS topic.
This virtual method must be overridden in derived classes to actually unsubscribe from a topic. It should do nothing if it is not subscribed in the first place.
Implemented in fkie_message_filters::Subscriber< M, Translate >, fkie_message_filters::CameraSubscriber, and fkie_message_filters::ImageSubscriber.