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 <cv_bridge/cv_bridge.h>
59 
61 #endif
62 
63 namespace jsk_rviz_plugins
64 {
65  class TrianglePolygon
66  {
67  public:
68 #if ROS_VERSION_MINIMUM(1,12,0)
69  typedef std::shared_ptr<TrianglePolygon> Ptr;
70 #else
72 #endif
73  TrianglePolygon(Ogre::SceneManager* manager,
74  Ogre::SceneNode* node,
75  const cv::Point3d& O,
76  const cv::Point3d& A,
77  const cv::Point3d& B,
78  const std::string& name,
79  const Ogre::ColourValue& color,
80  bool use_color,
81  bool upper_triangle);
82  virtual ~TrianglePolygon();
83  protected:
84  Ogre::ManualObject* manual_;
85  Ogre::SceneManager* manager_;
86  private:
87 
88  };
89 
90  class CameraInfoDisplay:
91  public rviz::MessageFilterDisplay<sensor_msgs::CameraInfo>
92  {
93  Q_OBJECT
94  public:
95 #if ROS_VERSION_MINIMUM(1,12,0)
96  typedef std::shared_ptr<rviz::Shape> ShapePtr;
97  typedef std::shared_ptr<rviz::BillboardLine> BillboardLinePtr;
98 #else
101 #endif
103  virtual ~CameraInfoDisplay();
104 
105  protected:
107  // methods required by super virtual class
109  virtual void onInitialize();
110  virtual void reset();
111  virtual void processMessage(const sensor_msgs::CameraInfo::ConstPtr& msg);
113  // methods
115  virtual void update(float wall_dt, float ros_dt);
116  virtual bool isSameCameraInfo(
117  const sensor_msgs::CameraInfo::ConstPtr& camera_info);
118  virtual void createCameraInfoShapes(
119  const sensor_msgs::CameraInfo::ConstPtr& camera_info);
120  virtual void addPointToEdge(
121  const cv::Point3d& point);
122  virtual void addPolygon(
123  const cv::Point3d& O, const cv::Point3d& A, const cv::Point3d& B, std::string name,
124  bool use_color, bool upper_triangle);
125  virtual void prepareMaterial();
126  virtual void createTextureForBottom(int width, int height);
127  virtual void imageCallback(const sensor_msgs::Image::ConstPtr& msg);
128  virtual void drawImageTexture();
129  virtual void subscribeImage(std::string topic);
131  // variables
133  std::vector<TrianglePolygon::Ptr> polygons_;
135  sensor_msgs::CameraInfo::ConstPtr camera_info_;
136  Ogre::MaterialPtr material_;
137  Ogre::TexturePtr texture_;
138  Ogre::MaterialPtr material_bottom_;
139  Ogre::TexturePtr bottom_texture_;
141  boost::mutex mutex_;
143  // variables updated by rviz properties
145  double alpha_;
146  double far_clip_distance_;
147  QColor color_;
148  QColor edge_color_;
150  bool show_edges_;
151  bool use_image_;
152  bool image_updated_;
154  cv::Mat image_;
156  // properties
168 
169  protected Q_SLOTS:
171  void updateAlpha();
172  void updateColor();
174  void updateShowPolygons();
176  void updateImageTopic();
179  };
180 
181 }
182 
183 #endif
jsk_rviz_plugins::CameraInfoDisplay::show_edges_property_
rviz::BoolProperty * show_edges_property_
Definition: camera_info_display.h:199
rviz::MessageFilterDisplay
jsk_rviz_plugins::TrianglePolygon::manual_
Ogre::ManualObject * manual_
Definition: camera_info_display.h:148
jsk_rviz_plugins::CameraInfoDisplay::image_transport_hints_property_
ImageTransportHintsProperty * image_transport_hints_property_
Definition: camera_info_display.h:190
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:131
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:167
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:183
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:197
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:181
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:172
display.h
jsk_rviz_plugins::CameraInfoDisplay::polygons_
std::vector< TrianglePolygon::Ptr > polygons_
Definition: camera_info_display.h:165
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:179
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:182
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:195
jsk_rviz_plugins::CameraInfoDisplay::material_bottom_
Ogre::MaterialPtr material_bottom_
Definition: camera_info_display.h:170
jsk_rviz_plugins::CameraInfoDisplay::texture_
Ogre::TexturePtr texture_
Definition: camera_info_display.h:169
jsk_rviz_plugins::CameraInfoDisplay::mutex_
boost::mutex mutex_
Definition: camera_info_display.h:173
jsk_rviz_plugins::CameraInfoDisplay::alpha_
double alpha_
Definition: camera_info_display.h:177
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:178
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:180
image_transport_hints_property.h
jsk_rviz_plugins::CameraInfoDisplay::edges_
BillboardLinePtr edges_
Definition: camera_info_display.h:166
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:198
jsk_rviz_plugins::CameraInfoDisplay::color_property_
rviz::ColorProperty * color_property_
Definition: camera_info_display.h:193
jsk_rviz_plugins::CameraInfoDisplay::not_show_side_polygons_
bool not_show_side_polygons_
Definition: camera_info_display.h:185
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:149
jsk_rviz_plugins::CameraInfoDisplay::image_
cv::Mat image_
Definition: camera_info_display.h:186
jsk_rviz_plugins::CameraInfoDisplay::bottom_texture_
Ogre::TexturePtr bottom_texture_
Definition: camera_info_display.h:171
cv_bridge.h
jsk_rviz_plugins::CameraInfoDisplay::far_clip_distance_property_
rviz::FloatProperty * far_clip_distance_property_
Definition: camera_info_display.h:191
jsk_rviz_plugins::CameraInfoDisplay::edge_color_property_
rviz::ColorProperty * edge_color_property_
Definition: camera_info_display.h:194
jsk_rviz_plugins::CameraInfoDisplay::material_
Ogre::MaterialPtr material_
Definition: camera_info_display.h:168
jsk_rviz_plugins::CameraInfoDisplay::alpha_property_
rviz::FloatProperty * alpha_property_
Definition: camera_info_display.h:192
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:196
jsk_rviz_plugins::CameraInfoDisplay::BillboardLinePtr
boost::shared_ptr< rviz::BillboardLine > BillboardLinePtr
Definition: camera_info_display.h:132
jsk_rviz_plugins::TrianglePolygon::Ptr
boost::shared_ptr< TrianglePolygon > Ptr
Definition: camera_info_display.h:135
jsk_rviz_plugins
Definition: __init__.py:1
jsk_rviz_plugins::CameraInfoDisplay::image_updated_
bool image_updated_
Definition: camera_info_display.h:184
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 Aug 2 2024 08:50:14