image_display_base.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012, Willow Garage, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Willow Garage, Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 #ifndef IMAGE_DISPLAY_BASE_H
30 #define IMAGE_DISPLAY_BASE_H
31 
32 #include <QObject>
33 
34 #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829
36 #include <tf2_ros/message_filter.h>
37 #include <sensor_msgs/Image.h>
38 
41 
42 #include "rviz/display_context.h"
43 #include "rviz/frame_manager.h"
47 
48 #include "rviz/display.h"
49 #include "rviz/rviz_export.h"
50 #endif
51 
52 namespace rviz
53 {
63 class RVIZ_EXPORT ImageDisplayBase : public Display
64 {
65  Q_OBJECT
66 public:
69  ~ImageDisplayBase() override;
70 
71  void setTopic(const QString& topic, const QString& datatype) override;
72 
73 protected Q_SLOTS:
75  virtual void updateTopic();
76 
78  virtual void updateQueueSize();
79 
81  void fillTransportOptionList(EnumProperty* property);
82 
83 protected:
84  void onInitialize() override;
85 
87  void reset() override;
88 
90  void enableTFFilter(std::string& targetFrame)
91  {
92  targetFrame_ = targetFrame;
93  reset();
94  }
95 
97  virtual void subscribe();
98  virtual void unsubscribe();
99 
100  void fixedFrameChanged() override;
101 
105  void incomingMessage(const sensor_msgs::Image::ConstPtr& msg);
106 
108  void failedMessage(const sensor_msgs::Image::ConstPtr& msg, tf2_ros::FilterFailureReason reason);
109 
113  virtual void processMessage(const sensor_msgs::Image::ConstPtr& msg) = 0;
114 
115  void scanForTransportSubscriberPlugins();
116 
117  boost::scoped_ptr<image_transport::ImageTransport> it_;
120 
121  std::string targetFrame_;
122 
124 
128 
129  std::string transport_;
130 
131  std::set<std::string> transport_plugin_types_;
132 
134 };
135 
136 } // end namespace rviz
137 
138 #endif // IMAGE_DISPLAY_BASE_H
boost::shared_ptr< tf2_ros::MessageFilter< sensor_msgs::Image > > tf_filter_
Property specialized to provide max/min enforcement for integers.
Definition: int_property.h:37
void subscribe()
BoolProperty * unreliable_property_
IntProperty * queue_size_property_
const char * datatype()
Display subclass for subscribing and displaying to image messages.
void enableTFFilter(std::string &targetFrame)
Enabling TF filtering by defining a target frame.
EnumProperty * transport_property_
RosTopicProperty * topic_property_
Property specialized to provide getter for booleans.
Definition: bool_property.h:38
std::set< std::string > transport_plugin_types_
void unsubscribe()
boost::shared_ptr< image_transport::SubscriberFilter > sub_
Enum property.
Definition: enum_property.h:46
boost::scoped_ptr< image_transport::ImageTransport > it_


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust
autogenerated on Sat May 27 2023 02:06:24