camera_info_display.h
Go to the documentation of this file.
1 // -*- mode: c++ -*-
2 /*********************************************************************
3  * Software License Agreement (BSD License)
4  *
5  * Copyright (c) 2014, JSK Lab
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * * Neither the name of the JSK Lab nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  *********************************************************************/
35 
36 
37 #ifndef JSK_RVIZ_PLUGINS_CAMERA_INFO_DISPLAY_H_
38 #define JSK_RVIZ_PLUGINS_CAMERA_INFO_DISPLAY_H_
39 
40 #ifndef Q_MOC_RUN
41 #include <rviz/display.h>
49 #include <OGRE/OgreSceneNode.h>
51 #include <sensor_msgs/Image.h>
52 #include <OGRE/OgreManualObject.h>
53 #include <OGRE/OgreSceneManager.h>
54 #include <OGRE/OgreTextureManager.h>
55 #include <OGRE/OgreTexture.h>
56 #include <OGRE/OgreTechnique.h>
57 #include <cv_bridge/cv_bridge.h>
60 
62 #endif
63 
64 namespace jsk_rviz_plugins
65 {
66  class TrianglePolygon
67  {
68  public:
69 #if ROS_VERSION_MINIMUM(1,12,0)
70  typedef std::shared_ptr<TrianglePolygon> Ptr;
71 #else
73 #endif
74  TrianglePolygon(Ogre::SceneManager* manager,
75  Ogre::SceneNode* node,
76  const cv::Point3d& O,
77  const cv::Point3d& A,
78  const cv::Point3d& B,
79  const std::string& name,
80  const Ogre::ColourValue& color,
81  bool use_color,
82  bool upper_triangle);
83  virtual ~TrianglePolygon();
84  protected:
85  Ogre::ManualObject* manual_;
86  Ogre::SceneManager* manager_;
87  private:
88 
89  };
90 
91  class CameraInfoDisplay:
92  public rviz::MessageFilterDisplay<sensor_msgs::CameraInfo>
93  {
94  Q_OBJECT
95  public:
96 #if ROS_VERSION_MINIMUM(1,12,0)
97  typedef std::shared_ptr<rviz::Shape> ShapePtr;
98  typedef std::shared_ptr<rviz::BillboardLine> BillboardLinePtr;
99 #else
102 #endif
104  virtual ~CameraInfoDisplay();
105 
106  protected:
108  // methods required by super virtual class
110  virtual void onInitialize();
111  virtual void reset();
112  virtual void processMessage(const sensor_msgs::CameraInfo::ConstPtr& msg);
114  // methods
116  virtual void update(float wall_dt, float ros_dt);
117  virtual bool isSameCameraInfo(
118  const sensor_msgs::CameraInfo::ConstPtr& camera_info);
119  virtual void createCameraInfoShapes(
120  const sensor_msgs::CameraInfo::ConstPtr& camera_info);
121  virtual void addPointToEdge(
122  const cv::Point3d& point);
123  virtual void addPolygon(
124  const cv::Point3d& O, const cv::Point3d& A, const cv::Point3d& B, std::string name,
125  bool use_color, bool upper_triangle);
126  virtual void prepareMaterial();
127  virtual void createTextureForBottom(int width, int height);
128  virtual void imageCallback(const sensor_msgs::Image::ConstPtr& msg);
129  virtual void drawImageTexture();
130  virtual void subscribeImage(std::string topic);
132  // variables
134  std::vector<TrianglePolygon::Ptr> polygons_;
136  sensor_msgs::CameraInfo::ConstPtr camera_info_;
137  Ogre::MaterialPtr material_;
138  Ogre::TexturePtr texture_;
139  Ogre::MaterialPtr material_bottom_;
140  Ogre::TexturePtr bottom_texture_;
142  boost::mutex mutex_;
144  // variables updated by rviz properties
146  double alpha_;
147  double far_clip_distance_;
148  QColor color_;
149  QColor edge_color_;
151  bool show_edges_;
152  bool use_image_;
153  bool image_updated_;
155  cv::Mat image_;
157  // properties
169 
170  protected Q_SLOTS:
172  void updateAlpha();
173  void updateColor();
175  void updateShowPolygons();
177  void updateImageTopic();
180  };
181 
182 }
183 
184 #endif
jsk_rviz_plugins::CameraInfoDisplay::show_edges_property_
rviz::BoolProperty * show_edges_property_
Definition: camera_info_display.h:200
rviz::MessageFilterDisplay
jsk_rviz_plugins::TrianglePolygon::manual_
Ogre::ManualObject * manual_
Definition: camera_info_display.h:149
jsk_rviz_plugins::CameraInfoDisplay::image_transport_hints_property_
ImageTransportHintsProperty * image_transport_hints_property_
Definition: camera_info_display.h:191
rviz::RosTopicProperty
jsk_rviz_plugins::CameraInfoDisplay::updateImageTopic
void updateImageTopic()
Definition: camera_info_display.cpp:695
jsk_rviz_plugins::CameraInfoDisplay::subscribeImage
virtual void subscribeImage(std::string topic)
Definition: camera_info_display.cpp:395
jsk_rviz_plugins::CameraInfoDisplay::updateShowEdges
void updateShowEdges()
Definition: camera_info_display.cpp:687
jsk_rviz_plugins::CameraInfoDisplay::ShapePtr
boost::shared_ptr< rviz::Shape > ShapePtr
Definition: camera_info_display.h:132
image_encodings.h
jsk_rviz_plugins::CameraInfoDisplay::updateUseImage
void updateUseImage()
Definition: camera_info_display.cpp:707
jsk_rviz_plugins::TrianglePolygon::TrianglePolygon
TrianglePolygon(Ogre::SceneManager *manager, Ogre::SceneNode *node, const cv::Point3d &O, const cv::Point3d &A, const cv::Point3d &B, const std::string &name, const Ogre::ColourValue &color, bool use_color, bool upper_triangle)
Definition: camera_info_display.cpp:82
boost::shared_ptr
jsk_rviz_plugins::CameraInfoDisplay::prepareMaterial
virtual void prepareMaterial()
Definition: camera_info_display.cpp:362
jsk_rviz_plugins::CameraInfoDisplay::updateNotShowSidePolygons
void updateNotShowSidePolygons()
Definition: camera_info_display.cpp:720
jsk_rviz_plugins::CameraInfoDisplay::camera_info_
sensor_msgs::CameraInfo::ConstPtr camera_info_
Definition: camera_info_display.h:168
jsk_rviz_plugins::CameraInfoDisplay::updateShowPolygons
void updateShowPolygons()
Definition: camera_info_display.cpp:673
pinhole_camera_model.h
jsk_rviz_plugins::CameraInfoDisplay::updateFarClipDistance
void updateFarClipDistance()
Definition: camera_info_display.cpp:665
rviz::BoolProperty
jsk_rviz_plugins::CameraInfoDisplay::use_image_
bool use_image_
Definition: camera_info_display.h:184
jsk_rviz_plugins::CameraInfoDisplay::reset
virtual void reset()
Definition: camera_info_display.cpp:211
jsk_rviz_plugins::CameraInfoDisplay::use_image_property_
rviz::BoolProperty * use_image_property_
Definition: camera_info_display.h:198
jsk_rviz_plugins::CameraInfoDisplay::~CameraInfoDisplay
virtual ~CameraInfoDisplay()
Definition: camera_info_display.cpp:198
jsk_rviz_plugins::CameraInfoDisplay::show_polygons_
bool show_polygons_
Definition: camera_info_display.h:182
jsk_rviz_plugins::CameraInfoDisplay::updateAlpha
void updateAlpha()
Definition: camera_info_display.cpp:657
jsk_rviz_plugins::CameraInfoDisplay::image_sub_
image_transport::Subscriber image_sub_
Definition: camera_info_display.h:173
display.h
jsk_rviz_plugins::CameraInfoDisplay::polygons_
std::vector< TrianglePolygon::Ptr > polygons_
Definition: camera_info_display.h:166
shape.h
jsk_rviz_plugins::CameraInfoDisplay::createCameraInfoShapes
virtual void createCameraInfoShapes(const sensor_msgs::CameraInfo::ConstPtr &camera_info)
Definition: camera_info_display.cpp:528
jsk_rviz_plugins::CameraInfoDisplay::addPointToEdge
virtual void addPointToEdge(const cv::Point3d &point)
Definition: camera_info_display.cpp:304
jsk_rviz_plugins::CameraInfoDisplay::drawImageTexture
virtual void drawImageTexture()
Definition: camera_info_display.cpp:408
jsk_rviz_plugins::CameraInfoDisplay::addPolygon
virtual void addPolygon(const cv::Point3d &O, const cv::Point3d &A, const cv::Point3d &B, std::string name, bool use_color, bool upper_triangle)
Definition: camera_info_display.cpp:314
jsk_rviz_plugins::CameraInfoDisplay::color_
QColor color_
Definition: camera_info_display.h:180
float_property.h
rviz::ColorProperty
billboard_line.h
image_transport::Subscriber
rviz::FloatProperty
jsk_rviz_plugins::CameraInfoDisplay::show_edges_
bool show_edges_
Definition: camera_info_display.h:183
jsk_rviz_plugins::CameraInfoDisplay::CameraInfoDisplay
CameraInfoDisplay()
Definition: camera_info_display.cpp:139
jsk_rviz_plugins::ImageTransportHintsProperty
Definition: image_transport_hints_property.h:10
jsk_rviz_plugins::CameraInfoDisplay::isSameCameraInfo
virtual bool isSameCameraInfo(const sensor_msgs::CameraInfo::ConstPtr &camera_info)
Definition: camera_info_display.cpp:274
A
bool_property.h
jsk_rviz_plugins::CameraInfoDisplay::show_polygons_property_
rviz::BoolProperty * show_polygons_property_
Definition: camera_info_display.h:196
jsk_rviz_plugins::CameraInfoDisplay::material_bottom_
Ogre::MaterialPtr material_bottom_
Definition: camera_info_display.h:171
jsk_rviz_plugins::CameraInfoDisplay::texture_
Ogre::TexturePtr texture_
Definition: camera_info_display.h:170
jsk_rviz_plugins::CameraInfoDisplay::mutex_
boost::mutex mutex_
Definition: camera_info_display.h:174
jsk_rviz_plugins::CameraInfoDisplay::alpha_
double alpha_
Definition: camera_info_display.h:178
subscriber.h
jsk_rviz_plugins::TrianglePolygon::~TrianglePolygon
virtual ~TrianglePolygon()
Definition: camera_info_display.cpp:133
message_filter_display.h
jsk_rviz_plugins::CameraInfoDisplay::update
virtual void update(float wall_dt, float ros_dt)
Definition: camera_info_display.cpp:262
jsk_rviz_plugins::CameraInfoDisplay::far_clip_distance_
double far_clip_distance_
Definition: camera_info_display.h:179
jsk_rviz_plugins::CameraInfoDisplay::updateColor
void updateColor()
Definition: camera_info_display.cpp:641
jsk_rviz_plugins::CameraInfoDisplay::edge_color_
QColor edge_color_
Definition: camera_info_display.h:181
image_transport_hints_property.h
jsk_rviz_plugins::CameraInfoDisplay::edges_
BillboardLinePtr edges_
Definition: camera_info_display.h:167
jsk_rviz_plugins::CameraInfoDisplay::imageCallback
virtual void imageCallback(const sensor_msgs::Image::ConstPtr &msg)
Definition: camera_info_display.cpp:446
jsk_rviz_plugins::CameraInfoDisplay::image_topic_property_
rviz::RosTopicProperty * image_topic_property_
Definition: camera_info_display.h:199
jsk_rviz_plugins::CameraInfoDisplay::color_property_
rviz::ColorProperty * color_property_
Definition: camera_info_display.h:194
jsk_rviz_plugins::CameraInfoDisplay::not_show_side_polygons_
bool not_show_side_polygons_
Definition: camera_info_display.h:186
jsk_rviz_plugins::CameraInfoDisplay::createTextureForBottom
virtual void createTextureForBottom(int width, int height)
Definition: camera_info_display.cpp:329
jsk_rviz_plugins::TrianglePolygon::manager_
Ogre::SceneManager * manager_
Definition: camera_info_display.h:150
jsk_rviz_plugins::CameraInfoDisplay::image_
cv::Mat image_
Definition: camera_info_display.h:187
jsk_rviz_plugins::CameraInfoDisplay::bottom_texture_
Ogre::TexturePtr bottom_texture_
Definition: camera_info_display.h:172
cv_bridge.h
jsk_rviz_plugins::CameraInfoDisplay::far_clip_distance_property_
rviz::FloatProperty * far_clip_distance_property_
Definition: camera_info_display.h:192
jsk_rviz_plugins::CameraInfoDisplay::edge_color_property_
rviz::ColorProperty * edge_color_property_
Definition: camera_info_display.h:195
jsk_rviz_plugins::CameraInfoDisplay::material_
Ogre::MaterialPtr material_
Definition: camera_info_display.h:169
jsk_rviz_plugins::CameraInfoDisplay::alpha_property_
rviz::FloatProperty * alpha_property_
Definition: camera_info_display.h:193
jsk_rviz_plugins::CameraInfoDisplay::updateEdgeColor
void updateEdgeColor()
Definition: camera_info_display.cpp:649
jsk_rviz_plugins::CameraInfoDisplay::not_show_side_polygons_property_
rviz::BoolProperty * not_show_side_polygons_property_
Definition: camera_info_display.h:197
jsk_rviz_plugins::CameraInfoDisplay::BillboardLinePtr
boost::shared_ptr< rviz::BillboardLine > BillboardLinePtr
Definition: camera_info_display.h:133
jsk_rviz_plugins::TrianglePolygon::Ptr
boost::shared_ptr< TrianglePolygon > Ptr
Definition: camera_info_display.h:136
jsk_rviz_plugins
Definition: __init__.py:1
jsk_rviz_plugins::CameraInfoDisplay::image_updated_
bool image_updated_
Definition: camera_info_display.h:185
jsk_rviz_plugins::CameraInfoDisplay::processMessage
virtual void processMessage(const sensor_msgs::CameraInfo::ConstPtr &msg)
Definition: camera_info_display.cpp:236
color_property.h
ros_topic_property.h
jsk_rviz_plugins::CameraInfoDisplay::onInitialize
virtual void onInitialize()
Definition: camera_info_display.cpp:221


jsk_rviz_plugins
Author(s): Kei Okada , Yohei Kakiuchi , Shohei Fujii , Ryohei Ueda
autogenerated on Fri Dec 13 2024 03:49:56