facing_visualizer.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_PLUGIN_FACING_VISUALIZER_H_
38 #define JSK_RVIZ_PLUGIN_FACING_VISUALIZER_H_
39 
40 #include <OGRE/OgreTexture.h>
41 #include <OGRE/OgreSceneManager.h>
42 #include <OGRE/OgreSceneNode.h>
43 #include <OGRE/OgreTexture.h>
44 #include <OGRE/OgreMaterial.h>
45 #include <OGRE/OgreManualObject.h>
46 #include <rviz/display_context.h>
47 #include <ros/time.h>
50 #include "overlay_utils.h"
51 
52 namespace jsk_rviz_plugins
53 {
54 
55  // outer radius
56  // inner radius
57  class SquareObject
58  {
59  public:
60 #if ROS_VERSION_MINIMUM(1,12,0)
61  typedef std::shared_ptr<SquareObject> Ptr;
62 #else
64 #endif
65  SquareObject(Ogre::SceneManager* manager,
66  double outer_radius,
67  double inner_radius,
68  std::string name);
69  enum PolygonType
70  {
71  CIRCLE, SQUARE
72  };
73 
74  virtual ~SquareObject();
75  virtual Ogre::ManualObject* getManualObject();
76  virtual void setOuterRadius(double outer_radius);
77  virtual void setInnerRadius(double inner_radius);
78  virtual void rebuildPolygon();
79  virtual void setPolygonType(PolygonType type);
80  protected:
81  Ogre::ManualObject* manual_;
82  Ogre::SceneManager* manager_;
83  double outer_radius_;
84  double inner_radius_;
85  std::string name_;
87  private:
88  };
89 
90  class TextureObject // utility class for texture
91  {
92  public:
93 #if ROS_VERSION_MINIMUM(1,12,0)
94  typedef std::shared_ptr<TextureObject> Ptr;
95 #else
97 #endif
98  TextureObject(const int width, const int height, const std::string name);
99  virtual ~TextureObject();
100  virtual int getWidth() { return width_; };
101  virtual int getHeight() { return height_; };
102  virtual ScopedPixelBuffer getBuffer();
103  virtual std::string getMaterialName();
104  protected:
105  Ogre::TexturePtr texture_;
106  Ogre::MaterialPtr material_;
107  const int width_;
108  const int height_;
109  const std::string name_;
110  private:
111 
112  };
113 
114  class FacingObject
115  {
116  public:
117 #if ROS_VERSION_MINIMUM(1,12,0)
118  typedef std::shared_ptr<FacingObject> Ptr;
119 #else
121 #endif
122  FacingObject(Ogre::SceneManager* manager,
123  Ogre::SceneNode* parent,
124  double size);
125  virtual ~FacingObject();
126  virtual void setPosition(Ogre::Vector3& pos);
127  virtual void setOrientation(rviz::DisplayContext* context);
128  virtual void setOrientation(Ogre::Quaternion& rot); // non facing API
129  virtual void update(float wall_dt, float ros_dt) = 0;
130  virtual void setSize(double size);
131  virtual void setEnable(bool enable);
132  virtual void setColor(QColor color);
133  virtual void setColor(Ogre::ColourValue color);
134  virtual void setText(std::string text);
135  virtual void setAlpha(double alpha);
136  protected:
137  virtual void updateColor() = 0;
138  virtual void updateText() = 0;
139  Ogre::SceneManager* scene_manager_;
140  Ogre::SceneNode* node_;
141  Ogre::ColourValue color_;
142  double size_;
143  bool enable_;
144  std::string text_;
145  private:
146 
147  };
148 
150  {
151  public:
152 #if ROS_VERSION_MINIMUM(1,12,0)
153  typedef std::shared_ptr<SimpleCircleFacingVisualizer> Ptr;
154 #else
156 #endif
157  SimpleCircleFacingVisualizer(Ogre::SceneManager* manager,
158  Ogre::SceneNode* parent,
159  rviz::DisplayContext* context,
160  double size,
161  std::string text = "");
163  virtual void update(float wall_dt, float ros_dt);
164  virtual void reset();
165 
166  virtual void setSize(double size);
167  virtual void setEnable(bool enable);
168  virtual void setText(std::string text);
169  protected:
170  virtual void updateArrowsObjects(Ogre::ColourValue color);
171  virtual void createArrows(rviz::DisplayContext* context);
172  virtual void updateLine();
173  virtual void updateTextUnderLine();
174  virtual void updateText();
175  virtual void updateColor();
178  Ogre::ManualObject* upper_arrow_;
179  Ogre::ManualObject* lower_arrow_;
180  Ogre::ManualObject* left_arrow_;
181  Ogre::ManualObject* right_arrow_;
182  Ogre::SceneNode* upper_arrow_node_;
183  Ogre::SceneNode* lower_arrow_node_;
184  Ogre::SceneNode* left_arrow_node_;
185  Ogre::SceneNode* right_arrow_node_;
186  Ogre::MaterialPtr upper_material_;
187  Ogre::MaterialPtr lower_material_;
188  Ogre::MaterialPtr left_material_;
189  Ogre::MaterialPtr right_material_;
190  std::string upper_material_name_;
191  std::string left_material_name_;
192  std::string lower_material_name_;
193  std::string right_material_name_;
195  Ogre::SceneNode* target_text_node_;
196  private:
197 
198  };
199 
200  class FacingTexturedObject: public FacingObject
201  {
202  public:
203 #if ROS_VERSION_MINIMUM(1,12,0)
204  typedef std::shared_ptr<FacingTexturedObject> Ptr;
205 #else
207 #endif
208  FacingTexturedObject(Ogre::SceneManager* manager,
209  Ogre::SceneNode* parent,
210  double size);
211  virtual void setSize(double size);
212  protected:
215 
216  private:
217 
218  };
219 
221  {
222  public:
223 #if ROS_VERSION_MINIMUM(1,12,0)
224  typedef std::shared_ptr<GISCircleVisualizer> Ptr;
225 #else
227 #endif
228  GISCircleVisualizer(Ogre::SceneManager* manager,
229  Ogre::SceneNode* parent,
230  double size,
231  std::string text = "");
232  virtual void setText(std::string text) { text_ = text; }
233  virtual void update(float wall_dt, float ros_dt);
234  virtual void setAnonymous(bool anonymous);
235  protected:
236  virtual void updateColor() {}
237  virtual void updateText() {}
238  virtual void setSize(double size);
239  bool anonymous_;
240  std::string text_;
241  private:
242  };
243 
244 }
245 
246 #endif
rviz::BillboardLine
tf_diff_text.rot
rot
Definition: tf_diff_text.py:18
jsk_rviz_plugins::GISCircleVisualizer::GISCircleVisualizer
GISCircleVisualizer(Ogre::SceneManager *manager, Ogre::SceneNode *parent, double size, std::string text="")
Definition: facing_visualizer.cpp:640
jsk_rviz_plugins::SquareObject::name_
std::string name_
Definition: facing_visualizer.h:149
jsk_rviz_plugins::SimpleCircleFacingVisualizer::msg_
rviz::MovableText * msg_
Definition: facing_visualizer.h:226
jsk_rviz_plugins::SimpleCircleFacingVisualizer::upper_arrow_node_
Ogre::SceneNode * upper_arrow_node_
Definition: facing_visualizer.h:214
jsk_rviz_plugins::TextureObject::getWidth
virtual int getWidth()
Definition: facing_visualizer.h:132
jsk_rviz_plugins::FacingTexturedObject::setSize
virtual void setSize(double size)
Definition: facing_visualizer.cpp:633
jsk_rviz_plugins::GISCircleVisualizer::anonymous_
bool anonymous_
Definition: facing_visualizer.h:271
jsk_rviz_plugins::SimpleCircleFacingVisualizer::upper_material_
Ogre::MaterialPtr upper_material_
Definition: facing_visualizer.h:218
boost::shared_ptr< SquareObject >
jsk_rviz_plugins::SquareObject::setPolygonType
virtual void setPolygonType(PolygonType type)
Definition: facing_visualizer.cpp:186
jsk_rviz_plugins::SimpleCircleFacingVisualizer::createArrows
virtual void createArrows(rviz::DisplayContext *context)
Definition: facing_visualizer.cpp:475
jsk_rviz_plugins::SimpleCircleFacingVisualizer::updateText
virtual void updateText()
Definition: facing_visualizer.cpp:597
tf_diff_text.pos
pos
Definition: tf_diff_text.py:18
jsk_rviz_plugins::TextureObject::name_
const std::string name_
Definition: facing_visualizer.h:141
jsk_rviz_plugins::SimpleCircleFacingVisualizer::lower_material_
Ogre::MaterialPtr lower_material_
Definition: facing_visualizer.h:219
jsk_rviz_plugins::FacingObject::setOrientation
virtual void setOrientation(rviz::DisplayContext *context)
Definition: facing_visualizer.cpp:263
jsk_rviz_plugins::ScopedPixelBuffer
Definition: overlay_utils.h:101
jsk_rviz_plugins::GISCircleVisualizer::updateText
virtual void updateText()
Definition: facing_visualizer.h:269
jsk_rviz_plugins::SquareObject::~SquareObject
virtual ~SquareObject()
Definition: facing_visualizer.cpp:92
jsk_rviz_plugins::SquareObject::setOuterRadius
virtual void setOuterRadius(double outer_radius)
Definition: facing_visualizer.cpp:103
jsk_rviz_plugins::FacingObject::size_
double size_
Definition: facing_visualizer.h:174
jsk_rviz_plugins::SquareObject::manual_
Ogre::ManualObject * manual_
Definition: facing_visualizer.h:145
time.h
jsk_rviz_plugins::SquareObject::inner_radius_
double inner_radius_
Definition: facing_visualizer.h:148
jsk_rviz_plugins::SimpleCircleFacingVisualizer
Definition: facing_visualizer.h:181
jsk_rviz_plugins::SimpleCircleFacingVisualizer::upper_material_name_
std::string upper_material_name_
Definition: facing_visualizer.h:222
jsk_rviz_plugins::FacingTexturedObject::square_object_
SquareObject::Ptr square_object_
Definition: facing_visualizer.h:245
jsk_rviz_plugins::FacingObject::setPosition
virtual void setPosition(Ogre::Vector3 &pos)
Definition: facing_visualizer.cpp:258
jsk_rviz_plugins::TextureObject::material_
Ogre::MaterialPtr material_
Definition: facing_visualizer.h:138
jsk_rviz_plugins::SimpleCircleFacingVisualizer::SimpleCircleFacingVisualizer
SimpleCircleFacingVisualizer(Ogre::SceneManager *manager, Ogre::SceneNode *parent, rviz::DisplayContext *context, double size, std::string text="")
Definition: facing_visualizer.cpp:315
jsk_rviz_plugins::SimpleCircleFacingVisualizer::updateLine
virtual void updateLine()
Definition: facing_visualizer.cpp:535
jsk_rviz_plugins::GISCircleVisualizer::setText
virtual void setText(std::string text)
Definition: facing_visualizer.h:264
jsk_rviz_plugins::GISCircleVisualizer::update
virtual void update(float wall_dt, float ros_dt)
Definition: facing_visualizer.cpp:649
jsk_rviz_plugins::SimpleCircleFacingVisualizer::text_under_line_
rviz::BillboardLine * text_under_line_
Definition: facing_visualizer.h:209
jsk_rviz_plugins::SquareObject::CIRCLE
@ CIRCLE
Definition: facing_visualizer.h:135
rviz::MovableText
jsk_rviz_plugins::FacingTexturedObject::Ptr
boost::shared_ptr< FacingTexturedObject > Ptr
Definition: facing_visualizer.h:238
jsk_rviz_plugins::FacingTexturedObject
Definition: facing_visualizer.h:232
jsk_rviz_plugins::FacingObject::enable_
bool enable_
Definition: facing_visualizer.h:175
billboard_line.h
overlay_sample.text
text
Definition: overlay_sample.py:21
jsk_rviz_plugins::SquareObject::SquareObject
SquareObject(Ogre::SceneManager *manager, double outer_radius, double inner_radius, std::string name)
Definition: facing_visualizer.cpp:81
jsk_rviz_plugins::SquareObject::manager_
Ogre::SceneManager * manager_
Definition: facing_visualizer.h:146
jsk_rviz_plugins::SquareObject::outer_radius_
double outer_radius_
Definition: facing_visualizer.h:147
jsk_rviz_plugins::SimpleCircleFacingVisualizer::line_
rviz::BillboardLine * line_
Definition: facing_visualizer.h:208
jsk_rviz_plugins::SimpleCircleFacingVisualizer::updateArrowsObjects
virtual void updateArrowsObjects(Ogre::ColourValue color)
Definition: facing_visualizer.cpp:379
jsk_rviz_plugins::TextureObject::Ptr
boost::shared_ptr< TextureObject > Ptr
Definition: facing_visualizer.h:128
overlay_utils.h
jsk_rviz_plugins::FacingObject::FacingObject
FacingObject(Ogre::SceneManager *manager, Ogre::SceneNode *parent, double size)
Definition: facing_visualizer.cpp:244
jsk_rviz_plugins::SimpleCircleFacingVisualizer::right_material_name_
std::string right_material_name_
Definition: facing_visualizer.h:225
jsk_rviz_plugins::GISCircleVisualizer::setAnonymous
virtual void setAnonymous(bool anonymous)
Definition: facing_visualizer.cpp:709
jsk_rviz_plugins::FacingObject::setText
virtual void setText(std::string text)
Definition: facing_visualizer.cpp:288
jsk_rviz_plugins::SimpleCircleFacingVisualizer::left_material_
Ogre::MaterialPtr left_material_
Definition: facing_visualizer.h:220
jsk_rviz_plugins::TextureObject::getHeight
virtual int getHeight()
Definition: facing_visualizer.h:133
jsk_rviz_plugins::FacingObject::scene_manager_
Ogre::SceneManager * scene_manager_
Definition: facing_visualizer.h:171
jsk_rviz_plugins::SimpleCircleFacingVisualizer::left_arrow_
Ogre::ManualObject * left_arrow_
Definition: facing_visualizer.h:212
jsk_rviz_plugins::SimpleCircleFacingVisualizer::Ptr
boost::shared_ptr< SimpleCircleFacingVisualizer > Ptr
Definition: facing_visualizer.h:187
jsk_rviz_plugins::SimpleCircleFacingVisualizer::right_arrow_node_
Ogre::SceneNode * right_arrow_node_
Definition: facing_visualizer.h:217
jsk_rviz_plugins::TextureObject::TextureObject
TextureObject(const int width, const int height, const std::string name)
Definition: facing_visualizer.cpp:191
jsk_rviz_plugins::SquareObject::setInnerRadius
virtual void setInnerRadius(double inner_radius)
Definition: facing_visualizer.cpp:108
jsk_rviz_plugins::GISCircleVisualizer::Ptr
boost::shared_ptr< GISCircleVisualizer > Ptr
Definition: facing_visualizer.h:258
contact_state_marker.alpha
alpha
Definition: contact_state_marker.py:90
jsk_rviz_plugins::SimpleCircleFacingVisualizer::update
virtual void update(float wall_dt, float ros_dt)
Definition: facing_visualizer.cpp:361
rviz::DisplayContext
jsk_rviz_plugins::TextureObject::texture_
Ogre::TexturePtr texture_
Definition: facing_visualizer.h:137
jsk_rviz_plugins::GISCircleVisualizer::setSize
virtual void setSize(double size)
Definition: facing_visualizer.cpp:722
jsk_rviz_plugins::SquareObject::polygon_type_
PolygonType polygon_type_
Definition: facing_visualizer.h:150
jsk_rviz_plugins::TextureObject::width_
const int width_
Definition: facing_visualizer.h:139
width
width
jsk_rviz_plugins::FacingObject::updateText
virtual void updateText()=0
jsk_rviz_plugins::FacingObject::node_
Ogre::SceneNode * node_
Definition: facing_visualizer.h:172
jsk_rviz_plugins::SimpleCircleFacingVisualizer::left_arrow_node_
Ogre::SceneNode * left_arrow_node_
Definition: facing_visualizer.h:216
jsk_rviz_plugins::TextureObject::getBuffer
virtual ScopedPixelBuffer getBuffer()
Definition: facing_visualizer.cpp:234
jsk_rviz_plugins::FacingObject
Definition: facing_visualizer.h:146
jsk_rviz_plugins::FacingTexturedObject::FacingTexturedObject
FacingTexturedObject(Ogre::SceneManager *manager, Ogre::SceneNode *parent, double size)
Definition: facing_visualizer.cpp:618
jsk_rviz_plugins::FacingObject::Ptr
boost::shared_ptr< FacingObject > Ptr
Definition: facing_visualizer.h:152
jsk_rviz_plugins::FacingObject::setSize
virtual void setSize(double size)
Definition: facing_visualizer.cpp:277
jsk_rviz_plugins::TextureObject::~TextureObject
virtual ~TextureObject()
Definition: facing_visualizer.cpp:228
jsk_rviz_plugins::SimpleCircleFacingVisualizer::lower_arrow_node_
Ogre::SceneNode * lower_arrow_node_
Definition: facing_visualizer.h:215
jsk_rviz_plugins::SimpleCircleFacingVisualizer::right_arrow_
Ogre::ManualObject * right_arrow_
Definition: facing_visualizer.h:213
jsk_rviz_plugins::SquareObject::rebuildPolygon
virtual void rebuildPolygon()
Definition: facing_visualizer.cpp:113
jsk_rviz_plugins::FacingObject::setEnable
virtual void setEnable(bool enable)
Definition: facing_visualizer.cpp:282
jsk_rviz_plugins::GISCircleVisualizer::updateColor
virtual void updateColor()
Definition: facing_visualizer.h:268
jsk_rviz_plugins::SimpleCircleFacingVisualizer::setEnable
virtual void setEnable(bool enable)
Definition: facing_visualizer.cpp:589
jsk_rviz_plugins::FacingObject::update
virtual void update(float wall_dt, float ros_dt)=0
jsk_rviz_plugins::SimpleCircleFacingVisualizer::right_material_
Ogre::MaterialPtr right_material_
Definition: facing_visualizer.h:221
jsk_rviz_plugins::SimpleCircleFacingVisualizer::setSize
virtual void setSize(double size)
Definition: facing_visualizer.cpp:581
jsk_rviz_plugins::SquareObject::SQUARE
@ SQUARE
Definition: facing_visualizer.h:135
movable_text.h
jsk_rviz_plugins::SquareObject::PolygonType
PolygonType
Definition: facing_visualizer.h:133
jsk_rviz_plugins::FacingObject::color_
Ogre::ColourValue color_
Definition: facing_visualizer.h:173
jsk_rviz_plugins::FacingObject::setColor
virtual void setColor(QColor color)
Definition: facing_visualizer.cpp:301
jsk_rviz_plugins::GISCircleVisualizer::text_
std::string text_
Definition: facing_visualizer.h:272
jsk_rviz_plugins::SimpleCircleFacingVisualizer::target_text_node_
Ogre::SceneNode * target_text_node_
Definition: facing_visualizer.h:227
jsk_rviz_plugins::SimpleCircleFacingVisualizer::reset
virtual void reset()
Definition: facing_visualizer.cpp:372
jsk_rviz_plugins::SimpleCircleFacingVisualizer::lower_arrow_
Ogre::ManualObject * lower_arrow_
Definition: facing_visualizer.h:211
height
height
jsk_rviz_plugins::SquareObject::Ptr
boost::shared_ptr< SquareObject > Ptr
Definition: facing_visualizer.h:127
jsk_rviz_plugins::SimpleCircleFacingVisualizer::~SimpleCircleFacingVisualizer
virtual ~SimpleCircleFacingVisualizer()
Definition: facing_visualizer.cpp:342
jsk_rviz_plugins::FacingTexturedObject::texture_object_
TextureObject::Ptr texture_object_
Definition: facing_visualizer.h:246
jsk_rviz_plugins::TextureObject::getMaterialName
virtual std::string getMaterialName()
Definition: facing_visualizer.cpp:239
jsk_rviz_plugins::SimpleCircleFacingVisualizer::left_material_name_
std::string left_material_name_
Definition: facing_visualizer.h:223
jsk_rviz_plugins::GISCircleVisualizer
Definition: facing_visualizer.h:252
jsk_rviz_plugins::SimpleCircleFacingVisualizer::setText
virtual void setText(std::string text)
Definition: facing_visualizer.cpp:603
jsk_rviz_plugins::TextureObject
Definition: facing_visualizer.h:122
jsk_rviz_plugins::SimpleCircleFacingVisualizer::updateTextUnderLine
virtual void updateTextUnderLine()
Definition: facing_visualizer.cpp:556
pictogram.size
size
Definition: pictogram.py:1713
jsk_rviz_plugins::FacingObject::text_
std::string text_
Definition: facing_visualizer.h:176
jsk_rviz_plugins::FacingObject::setAlpha
virtual void setAlpha(double alpha)
Definition: facing_visualizer.cpp:295
jsk_rviz_plugins::TextureObject::height_
const int height_
Definition: facing_visualizer.h:140
jsk_rviz_plugins
Definition: __init__.py:1
jsk_rviz_plugins::SquareObject::getManualObject
virtual Ogre::ManualObject * getManualObject()
Definition: facing_visualizer.cpp:98
jsk_rviz_plugins::FacingObject::updateColor
virtual void updateColor()=0
jsk_rviz_plugins::SimpleCircleFacingVisualizer::updateColor
virtual void updateColor()
Definition: facing_visualizer.cpp:610
jsk_rviz_plugins::SimpleCircleFacingVisualizer::lower_material_name_
std::string lower_material_name_
Definition: facing_visualizer.h:224
jsk_rviz_plugins::FacingObject::~FacingObject
virtual ~FacingObject()
Definition: facing_visualizer.cpp:252
jsk_rviz_plugins::SimpleCircleFacingVisualizer::upper_arrow_
Ogre::ManualObject * upper_arrow_
Definition: facing_visualizer.h:210
display_context.h


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