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
unsubscribe
void unsubscribe()
rviz::RosTopicProperty
Definition: ros_topic_property.h:39
rviz::ImageDisplayBase::enableTFFilter
void enableTFFilter(std::string &targetFrame)
Enabling TF filtering by defining a target frame.
Definition: image_display_base.h:90
frame_manager.h
boost::shared_ptr< image_transport::SubscriberFilter >
ros_topic_property.h
rviz::ImageDisplayBase::transport_
std::string transport_
Definition: image_display_base.h:129
tf2_ros::filter_failure_reasons::FilterFailureReason
FilterFailureReason
int_property.h
rviz::BoolProperty
Property specialized to provide getter for booleans.
Definition: bool_property.h:38
rviz::ImageDisplayBase::unreliable_property_
BoolProperty * unreliable_property_
Definition: image_display_base.h:133
rviz::ImageDisplayBase::tf_filter_
boost::shared_ptr< tf2_ros::MessageFilter< sensor_msgs::Image > > tf_filter_
Definition: image_display_base.h:119
rviz::Display
Definition: display.h:63
rviz::EnumProperty
Enum property.
Definition: enum_property.h:46
subscriber_filter.h
message_filter.h
rviz::ImageDisplayBase::it_
boost::scoped_ptr< image_transport::ImageTransport > it_
Definition: image_display_base.h:117
rviz
Definition: add_display_dialog.cpp:54
subscriber.h
subscribe
void subscribe()
image_transport.h
rviz::ImageDisplayBase
Display subclass for subscribing and displaying to image messages.
Definition: image_display_base.h:63
rviz::ImageDisplayBase::targetFrame_
std::string targetFrame_
Definition: image_display_base.h:121
display.h
rviz::ImageDisplayBase::sub_
boost::shared_ptr< image_transport::SubscriberFilter > sub_
Definition: image_display_base.h:118
datatype
const char * datatype()
display_context.h
rviz::ImageDisplayBase::topic_property_
RosTopicProperty * topic_property_
Definition: image_display_base.h:125
rviz::ImageDisplayBase::queue_size_property_
IntProperty * queue_size_property_
Definition: image_display_base.h:127
rviz::ImageDisplayBase::messages_received_
uint32_t messages_received_
Definition: image_display_base.h:123
rviz::ImageDisplayBase::transport_property_
EnumProperty * transport_property_
Definition: image_display_base.h:126
rviz::ImageDisplayBase::transport_plugin_types_
std::set< std::string > transport_plugin_types_
Definition: image_display_base.h:131
enum_property.h
rviz::IntProperty
Property specialized to provide max/min enforcement for integers.
Definition: int_property.h:37


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust, William Woodall
autogenerated on Fri Aug 2 2024 08:43:09