camera_display.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009, 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 
30 #ifndef RVIZ_CAMERA_DISPLAY_H
31 #define RVIZ_CAMERA_DISPLAY_H
32 
33 #include <QObject>
34 
35 #ifndef Q_MOC_RUN
36 #include <OgreMaterial.h>
37 #include <OgreRenderTargetListener.h>
38 #include <OgreSharedPtr.h>
39 
40 # include <sensor_msgs/CameraInfo.h>
41 
43 # include <tf/message_filter.h>
44 
47 # include "rviz/render_panel.h"
48 #endif
49 
50 namespace Ogre
51 {
52 class SceneNode;
53 class ManualObject;
54 class Rectangle2D;
55 class Camera;
56 }
57 
58 namespace rviz
59 {
60 
61 class EnumProperty;
62 class FloatProperty;
63 class IntProperty;
64 class RenderPanel;
65 class RosTopicProperty;
66 class DisplayGroupVisibilityProperty;
67 
72 class CameraDisplay: public ImageDisplayBase, public Ogre::RenderTargetListener
73 {
74 Q_OBJECT
75 public:
76  CameraDisplay();
77  virtual ~CameraDisplay();
78 
79  // Overrides from Display
80  virtual void onInitialize();
81  virtual void fixedFrameChanged();
82  virtual void update( float wall_dt, float ros_dt );
83  virtual void reset();
84 
85  // Overrides from Ogre::RenderTargetListener
86  virtual void preRenderTargetUpdate( const Ogre::RenderTargetEvent& evt );
87  virtual void postRenderTargetUpdate( const Ogre::RenderTargetEvent& evt );
88 
89  static const QString BACKGROUND;
90  static const QString OVERLAY;
91  static const QString BOTH;
92 
93 protected:
94  // overrides from Display
95  virtual void onEnable();
96  virtual void onDisable();
97 
100 
101 private Q_SLOTS:
102  void forceRender();
103  void updateAlpha();
104 
105  virtual void updateQueueSize();
106 
107 private:
108  void subscribe();
109  void unsubscribe();
110 
111  virtual void processMessage(const sensor_msgs::Image::ConstPtr& msg);
112  void caminfoCallback( const sensor_msgs::CameraInfo::ConstPtr& msg );
113 
114  bool updateCamera();
115 
116  void clear();
117  void updateStatus();
118 
119  Ogre::SceneNode* bg_scene_node_;
120  Ogre::SceneNode* fg_scene_node_;
121 
122  Ogre::Rectangle2D* bg_screen_rect_;
123  Ogre::MaterialPtr bg_material_;
124 
125  Ogre::Rectangle2D* fg_screen_rect_;
126  Ogre::MaterialPtr fg_material_;
127 
130 
135 
136  sensor_msgs::CameraInfo::ConstPtr current_caminfo_;
137  boost::mutex caminfo_mutex_;
138 
140 
142 
144 
145  uint32_t vis_bit_;
146 };
147 
148 } // namespace rviz
149 
150  #endif
FloatProperty * alpha_property_
sensor_msgs::CameraInfo::ConstPtr current_caminfo_
Ogre::SceneNode * bg_scene_node_
static const QString OVERLAY
static const QString BOTH
RenderPanel * render_panel_
tf::MessageFilter< sensor_msgs::CameraInfo > * caminfo_tf_filter_
Ogre::SceneNode * fg_scene_node_
Property specialized to enforce floating point max/min.
boost::mutex caminfo_mutex_
void update(const std::string &key, const XmlRpc::XmlRpcValue &v)
void subscribe()
EnumProperty * image_position_property_
Display subclass for subscribing and displaying to image messages.
Ogre::Rectangle2D * fg_screen_rect_
DisplayGroupVisibilityProperty * visibility_property_
FloatProperty * zoom_property_
Ogre::MaterialPtr fg_material_
static const QString BACKGROUND
Ogre::Rectangle2D * bg_screen_rect_
void unsubscribe()
message_filters::Subscriber< sensor_msgs::CameraInfo > caminfo_sub_
Ogre::MaterialPtr bg_material_
ROSImageTexture texture_
Enum property.
Definition: enum_property.h:47


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust
autogenerated on Sat Apr 27 2019 02:33:41