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 <memory>
34 
35 #include <QObject>
36 
37 #ifndef Q_MOC_RUN
38 #include <OgreMaterial.h>
39 #include <OgreRenderTargetListener.h>
40 #include <OgreSharedPtr.h>
41 
42 #include <sensor_msgs/CameraInfo.h>
43 
46 #include "rviz/render_panel.h"
47 #endif
48 
49 namespace Ogre
50 {
51 class SceneNode;
52 class ManualObject;
53 class Rectangle2D;
54 class Camera;
55 } // namespace Ogre
56 
57 namespace rviz
58 {
59 class EnumProperty;
60 class FloatProperty;
61 class IntProperty;
62 class RenderPanel;
63 class RosTopicProperty;
64 class DisplayGroupVisibilityProperty;
65 
70 class CameraDisplay : public ImageDisplayBase, public Ogre::RenderTargetListener
71 {
72  Q_OBJECT
73 public:
74  CameraDisplay();
75  ~CameraDisplay() override;
76 
77  // Overrides from Display
78  void onInitialize() override;
79  void fixedFrameChanged() override;
80  void update(float wall_dt, float ros_dt) override;
81  void reset() override;
82 
83  // Overrides from Ogre::RenderTargetListener
84  void preRenderTargetUpdate(const Ogre::RenderTargetEvent& evt) override;
85  void postRenderTargetUpdate(const Ogre::RenderTargetEvent& evt) override;
86 
87  static const QString BACKGROUND;
88  static const QString OVERLAY;
89  static const QString BOTH;
90 
91 protected:
92  // overrides from Display
93  void onEnable() override;
94  void onDisable() override;
95 
98 
99 private Q_SLOTS:
100  void forceRender();
101  void updateAlpha();
102 
103  void updateQueueSize() override;
104 
105 private:
106  void subscribe() override;
107  void unsubscribe() override;
108 
109  void processMessage(const sensor_msgs::Image::ConstPtr& msg) override;
110  void processCamInfoMessage(const sensor_msgs::CameraInfo::ConstPtr& msg);
111 
112  bool updateCamera();
113 
114  Ogre::SceneNode* bg_scene_node_;
115  Ogre::SceneNode* fg_scene_node_;
116 
117  Ogre::Rectangle2D* bg_screen_rect_;
118  Ogre::MaterialPtr bg_material_;
119 
120  Ogre::Rectangle2D* fg_screen_rect_;
121  Ogre::MaterialPtr fg_material_;
122 
124 
129 
130  sensor_msgs::CameraInfo::ConstPtr current_caminfo_;
131  boost::mutex caminfo_mutex_;
132 
134 
136 
137  uint32_t vis_bit_;
138 };
139 
140 } // namespace rviz
141 
142 #endif
rviz::CameraDisplay::processMessage
void processMessage(const sensor_msgs::Image::ConstPtr &msg) override
Implement this to process the contents of a message.
Definition: camera_display.cpp:508
Ogre
Definition: axes_display.h:35
rviz::CameraDisplay::postRenderTargetUpdate
void postRenderTargetUpdate(const Ogre::RenderTargetEvent &evt) override
Definition: camera_display.cpp:226
rviz::CameraDisplay::fixedFrameChanged
void fixedFrameChanged() override
Called by setFixedFrame(). Override to respond to changes to fixed_frame_.
Definition: camera_display.cpp:520
rviz::CameraDisplay::fg_material_
Ogre::MaterialPtr fg_material_
Definition: camera_display.h:121
rviz::CameraDisplay::preRenderTargetUpdate
void preRenderTargetUpdate(const Ogre::RenderTargetEvent &evt) override
Definition: camera_display.cpp:216
rviz::ROSImageTexture
Definition: ros_image_texture.h:58
rviz::CameraDisplay::BACKGROUND
static const QString BACKGROUND
Definition: camera_display.h:87
rviz::CameraDisplay::forceRender
void forceRender()
Definition: camera_display.cpp:297
rviz::CameraDisplay::caminfo_ok_
bool caminfo_ok_
Definition: camera_display.h:133
rviz::CameraDisplay::onInitialize
void onInitialize() override
Override this function to do subclass-specific initialization.
Definition: camera_display.cpp:127
rviz::CameraDisplay::processCamInfoMessage
void processCamInfoMessage(const sensor_msgs::CameraInfo::ConstPtr &msg)
Definition: camera_display.cpp:513
rviz::CameraDisplay::fg_scene_node_
Ogre::SceneNode * fg_scene_node_
Definition: camera_display.h:115
rviz::CameraDisplay::render_panel_
RenderPanel * render_panel_
Definition: camera_display.h:97
rviz::EnumProperty
Enum property.
Definition: enum_property.h:46
rviz::FloatProperty
Property specialized to enforce floating point max/min.
Definition: float_property.h:37
rviz::CameraDisplay::subscribe
void subscribe() override
ROS topic management.
Definition: camera_display.cpp:245
rviz::CameraDisplay::OVERLAY
static const QString OVERLAY
Definition: camera_display.h:88
rviz::CameraDisplay::caminfo_mutex_
boost::mutex caminfo_mutex_
Definition: camera_display.h:131
rviz::CameraDisplay::CameraDisplay
CameraDisplay()
Definition: camera_display.cpp:82
rviz::CameraDisplay::unsubscribe
void unsubscribe() override
Definition: camera_display.cpp:268
rviz::CameraDisplay::~CameraDisplay
~CameraDisplay() override
Definition: camera_display.cpp:108
rviz
Definition: add_display_dialog.cpp:54
rviz::CameraDisplay::onDisable
void onDisable() override
Derived classes override this to do the actual work of disabling themselves.
Definition: camera_display.cpp:238
rviz::CameraDisplay::updateCamera
bool updateCamera()
Definition: camera_display.cpp:326
rviz::CameraDisplay::visibility_property_
DisplayGroupVisibilityProperty * visibility_property_
Definition: camera_display.h:128
rviz::CameraDisplay::reset
void reset() override
Called to tell the display to clear its state.
Definition: camera_display.cpp:525
rviz::ImageDisplayBase
Display subclass for subscribing and displaying to image messages.
Definition: image_display_base.h:63
render_panel.h
rviz::CameraDisplay::alpha_property_
FloatProperty * alpha_property_
Definition: camera_display.h:125
rviz::CameraDisplay::texture_
ROSImageTexture texture_
Definition: camera_display.h:96
rviz::CameraDisplay::caminfo_sub_
ros::Subscriber caminfo_sub_
Definition: camera_display.h:123
rviz::CameraDisplay::update
void update(float wall_dt, float ros_dt) override
Called periodically by the visualization manager.
Definition: camera_display.cpp:308
rviz::CameraDisplay::bg_screen_rect_
Ogre::Rectangle2D * bg_screen_rect_
Definition: camera_display.h:117
rviz::CameraDisplay
Definition: camera_display.h:70
rviz::CameraDisplay::updateAlpha
void updateAlpha()
Definition: camera_display.cpp:277
rviz::CameraDisplay::vis_bit_
uint32_t vis_bit_
Definition: camera_display.h:137
rviz::CameraDisplay::bg_material_
Ogre::MaterialPtr bg_material_
Definition: camera_display.h:118
rviz::CameraDisplay::fg_screen_rect_
Ogre::Rectangle2D * fg_screen_rect_
Definition: camera_display.h:120
rviz::CameraDisplay::BOTH
static const QString BOTH
Definition: camera_display.h:89
rviz::RenderPanel
Definition: render_panel.h:74
rviz::CameraDisplay::current_caminfo_
sensor_msgs::CameraInfo::ConstPtr current_caminfo_
Definition: camera_display.h:130
image_display_base.h
rviz::CameraDisplay::updateQueueSize
void updateQueueSize() override
Definition: camera_display.cpp:303
rviz::CameraDisplay::image_position_property_
EnumProperty * image_position_property_
Definition: camera_display.h:126
rviz::CameraDisplay::onEnable
void onEnable() override
Derived classes override this to do the actual work of enabling themselves.
Definition: camera_display.cpp:232
rviz::CameraDisplay::bg_scene_node_
Ogre::SceneNode * bg_scene_node_
Definition: camera_display.h:114
ros::Subscriber
ros_image_texture.h
rviz::CameraDisplay::force_render_
bool force_render_
Definition: camera_display.h:135
rviz::CameraDisplay::zoom_property_
FloatProperty * zoom_property_
Definition: camera_display.h:127
rviz::DisplayGroupVisibilityProperty
Definition: display_group_visibility_property.h:57


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