image_subscriber.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * fkie_message_filters
4  * Copyright © 2018-2020 Fraunhofer FKIE
5  * Author: Timo Röhling
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  ****************************************************************************/
20 #ifndef INCLUDE_FKIE_MESSAGE_FILTERS_IMAGE_SUBSCRIBER_H_
21 #define INCLUDE_FKIE_MESSAGE_FILTERS_IMAGE_SUBSCRIBER_H_
22 
23 #include "subscriber_base.h"
24 #include "source.h"
25 #include <sensor_msgs/Image.h>
27 
28 namespace fkie_message_filters
29 {
30 
43 class ImageSubscriber : public SubscriberBase, public Source<sensor_msgs::ImageConstPtr>
44 {
45 public:
52  ImageSubscriber() noexcept {}
64  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;
77  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;
90  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;
94  virtual std::string topic() const noexcept override;
95 protected:
100  virtual bool is_configured() const noexcept override;
105  virtual void subscribe_impl() noexcept override;
110  virtual void unsubscribe_impl() noexcept override;
111 private:
112  void cb(const sensor_msgs::ImageConstPtr&);
113  std::shared_ptr<image_transport::ImageTransport> it_;
114  std::string base_topic_;
115  uint32_t queue_size_;
118 };
119 
120 } // namespace fkie_message_filters
121 
122 #endif /* INCLUDE_FKIE_MESSAGE_FILTERS_IMAGE_SUBSCRIBER_H_ */
virtual std::string topic() const noexcept override
Return the subscribed topic name.
Base class for data providers.
Definition: sink.h:33
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.
virtual bool is_configured() const noexcept override
Check if the ROS subscriber is properly configured.
image_transport::Subscriber sub_
virtual void subscribe_on_demand(PublisherBase &pub)
Subscribe to the configured ROS topic whenever the given publisher is active.
virtual void subscribe()
Subscribe to the configured ROS topic.
Base class for ROS subscribers in a filter pipeline.
virtual void subscribe_impl() noexcept override
Create a ROS subscriber.
virtual void unsubscribe_impl() noexcept override
Shut the ROS subscriber down.
Primary namespace.
Definition: buffer.h:33
ImageSubscriber() noexcept
Constructs an empty subscriber.
void cb(const sensor_msgs::ImageConstPtr &)
virtual void unsubscribe()
Unsubscribe from the configured ROS topic.
Subscribe to a ROS image topic as data provider.
std::shared_ptr< image_transport::ImageTransport > it_
image_transport::TransportHints hints_


fkie_message_filters
Author(s): Timo Röhling
autogenerated on Mon Feb 28 2022 22:21:43