FKIE Message Filters
Improved filters for processing ROS messages
|
Subscribe to a ROS image topic as data provider. More...
#include <fkie_message_filters/image_subscriber.h>
Public Types | |
using | Output = IO< Outputs... > |
Grouped output types. More... | |
Public Member Functions | |
ImageSubscriber () noexcept | |
Constructs an empty subscriber. More... | |
ImageSubscriber (const image_transport::ImageTransport &it, const std::string &base_topic, uint32_t queue_size, const image_transport::TransportHints &transport_hints=image_transport::TransportHints()) noexcept | |
Constructor that subscribes to the given ROS image topic. More... | |
Connection | connect_to_sink (Sink< Outputs... > &dst) noexcept |
Connect this source to a sink. More... | |
virtual void | disconnect () noexcept override |
Disconnect from all connected sinks. More... | |
void | disconnect_from_all_sinks () noexcept |
Disconnect from all connected sinks. More... | |
virtual void | reset () noexcept |
Reset filter state. More... | |
void | set_subscribe_options (const image_transport::ImageTransport &it, const std::string &base_topic, uint32_t queue_size, const image_transport::TransportHints &transport_hints=image_transport::TransportHints()) noexcept |
Configure ROS topic that is to be subscribed. More... | |
virtual void | subscribe () |
Subscribe to the configured ROS topic. More... | |
void | subscribe (const image_transport::ImageTransport &it, const std::string &base_topic, uint32_t queue_size, const image_transport::TransportHints &transport_hints=image_transport::TransportHints()) noexcept |
Convenience function to subscribe to a 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 noexcept |
Return the subscribed topic name. More... | |
virtual void | unsubscribe () |
Unsubscribe from the configured ROS topic. More... | |
Static Public Attributes | |
static constexpr std::size_t | NUM_OUTPUTS |
Number of output arguments. | |
Protected Member Functions | |
virtual bool | is_configured () const noexcept override |
Check if the ROS 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... | |
void | send (const Outputs &... out) |
Pass data to all connected sinks. More... | |
virtual void | subscribe_impl () noexcept override |
Create a ROS subscriber. More... | |
void | unlink_from_publisher () |
Remove self from the list of subscribers which are controlled by a publisher. More... | |
virtual void | unsubscribe_impl () noexcept override |
Shut the ROS subscriber down. More... | |
Subscribe to a ROS image topic as data provider.
This is a specialized subscriber that uses image_transport to subscribe to a ROS image topic. All messages which are received on the subscribed topic will be passed to the connected sinks for further processing.
Unlike regular ROS subscribers, this class can be associated with a publisher instance. In that case, the subscriber will delay subscription until the publisher is actively used and will unsubscribe (and stop passing data) as soon as the publisher becomes idle. This is a convenient method to save processing power if the filter pipeline is used only intermittently.
|
inherited |
Grouped output types.
This type can be used to define sinks with matching types.
|
inlinenoexcept |
Constructs an empty subscriber.
You need to call set_subscribe_options() and either subscribe() or subscribe_on_demand() to actually subscribe to a ROS topic.
|
noexcept |
Constructor that subscribes to the given ROS image topic.
This constructor calls set_subscribe_options() and subscribe() for you.
it
ROS image_transport instance to handle the subscription base_topic
name of the ROS image topic, subject to remapping queue_size
size of the ROS subscription queue transport_hints
transport hints for the ROS image_transport framework
|
noexceptinherited |
Connect this source to a sink.
Can be called multiple times to connect multiple sinks; in that case, the sinks receive data in the same order as they have been connected. This function does basically the same thing as Sink::connect_to_source(), only from the opposite point of view.
dst
the sink that is to be connected
|
overridevirtualnoexceptinherited |
Disconnect from all connected sinks.
The source implementation calls disconnect_from_all_sinks().
Implements fkie_message_filters::FilterBase.
|
noexceptinherited |
Disconnect from all connected sinks.
Severs the connection to all sinks, turning the send() method into a no-op.
|
overrideprotectedvirtualnoexcept |
Check if the ROS subscriber is properly configured.
Implements fkie_message_filters::SubscriberBase.
|
protectedinherited |
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
|
inlinevirtualnoexceptinherited |
Reset filter state.
For stateful filters, this method resets the internal state as if the filter had just been created. Existing connections to sources and sinks are unaffected.
The default implementation does nothing.
Reimplemented in fkie_message_filters::Buffer< Inputs >, fkie_message_filters::Buffer< Inputs... >, fkie_message_filters::TfFilter< Inputs >, fkie_message_filters::TfFilter< Inputs... >, fkie_message_filters::Combiner< PolicyTmpl, IOs >, fkie_message_filters::Sequencer< Inputs >, and fkie_message_filters::Sequencer< Inputs... >.
|
protectedinherited |
Pass data to all connected sinks.
out
data
|
noexcept |
Configure ROS topic that is to be subscribed.
All arguments are passed to the ROS client library; see the ROS documentation for further information. Calling this method will automatically unsubscribe any previously subscribed ROS topic.
it
ROS image_transport instance to handle the subscription base_topic
name of the ROS image topic, subject to remapping queue_size
size of the ROS subscription queue transport_hints
transport hints for the ROS image_transport framework
|
virtualinherited |
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.
|
noexcept |
Convenience function to subscribe to a ROS topic.
This function is equivalent to calling set_subscribe_options() and then subscribe().
it
ROS image_transport instance to handle the subscription base_topic
name of the ROS image topic, subject to remapping queue_size
size of the ROS subscription queue transport_hints
transport hints for the ROS image_transport framework
|
overrideprotectedvirtualnoexcept |
Create a ROS subscriber.
Implements fkie_message_filters::SubscriberBase.
|
virtualinherited |
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
|
virtualnoexcept |
Return the subscribed topic name.
Implements fkie_message_filters::SubscriberBase.
|
protectedinherited |
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.
|
virtualinherited |
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.
|
overrideprotectedvirtualnoexcept |
Shut the ROS subscriber down.
Implements fkie_message_filters::SubscriberBase.