torus_array_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 #ifndef JSK_RVIZ_PLUGINS_TORUS_ARRAY_DISPLAY_H_
37 #define JSK_RVIZ_PLUGINS_TORUS_ARRAY_DISPLAY_H_
38 
39 #ifndef Q_MOC_RUN
40 #include <jsk_recognition_msgs/TorusArray.h>
49 #include <OGRE/OgreSceneManager.h>
50 #include <OGRE/OgreSceneNode.h>
51 #endif
52 
53 namespace jsk_rviz_plugins
54 {
55  struct Triangle
56  {
57  unsigned v1, v2, v3; // index for the 3 vertices that make up a triangle
58  };
59 
60  class TorusArrayDisplay: public rviz::MessageFilterDisplay<jsk_recognition_msgs::TorusArray>
61  {
62  Q_OBJECT
63  public:
64 #if ROS_VERSION_MINIMUM(1,12,0)
65  typedef std::shared_ptr<rviz::Arrow> ArrowPtr;
66  typedef std::shared_ptr<rviz::MeshShape> ShapePtr;
67 #else
70 #endif
72  virtual ~TorusArrayDisplay();
73  protected:
74  virtual void onInitialize();
75  virtual void reset();
76  void allocateShapes(const jsk_recognition_msgs::TorusArray::ConstPtr& msg);
77  void allocateShapes(const size_t num);
78  QColor getColor(size_t index);
85  QColor color_;
86  double alpha_;
88  bool show_normal_;
89  double normal_length_;
90  int uv_dimension_;
91  std::vector<Ogre::SceneNode*> arrow_nodes_;
92  std::vector<ArrowPtr> arrow_objects_;
93  std::vector<ShapePtr> shapes_;
94  private Q_SLOTS:
95  void updateColor();
96  void updateAlpha();
97  void updateUVdimension();
98  void updateAutoColor();
99  void updateShowNormal();
101 
103  int large_dimension, int small_dimension,
104  float large_radius, float small_radius,
105  Ogre::Vector3 pos, Ogre::Quaternion q,
106  std::vector<Triangle> &triangles,
107  std::vector<Ogre::Vector3> &vertices,
108  std::vector<Ogre::Vector3> &normals
109  );
110  private:
111  void processMessage(const jsk_recognition_msgs::TorusArray::ConstPtr& msg);
112  };
113 
114 }
115 #endif
rviz::MessageFilterDisplay
boost::shared_ptr< rviz::Arrow >
jsk_rviz_plugins::TorusArrayDisplay::calcurateTriangleMesh
void calcurateTriangleMesh(int large_dimension, int small_dimension, float large_radius, float small_radius, Ogre::Vector3 pos, Ogre::Quaternion q, std::vector< Triangle > &triangles, std::vector< Ogre::Vector3 > &vertices, std::vector< Ogre::Vector3 > &normals)
Definition: torus_array_display.cpp:171
jsk_rviz_plugins::Triangle::v1
unsigned v1
Definition: torus_array_display.h:121
jsk_rviz_plugins::TorusArrayDisplay::show_normal_
bool show_normal_
Definition: torus_array_display.h:120
tf_diff_text.pos
pos
Definition: tf_diff_text.py:18
jsk_rviz_plugins::TorusArrayDisplay::updateColor
void updateColor()
Definition: torus_array_display.cpp:103
jsk_rviz_plugins::TorusArrayDisplay::color_
QColor color_
Definition: torus_array_display.h:117
rviz::BoolProperty
jsk_rviz_plugins::TorusArrayDisplay::TorusArrayDisplay
TorusArrayDisplay()
Definition: torus_array_display.cpp:42
int_property.h
jsk_rviz_plugins::TorusArrayDisplay::updateUVdimension
void updateUVdimension()
Definition: torus_array_display.cpp:113
jsk_rviz_plugins::TorusArrayDisplay::arrow_nodes_
std::vector< Ogre::SceneNode * > arrow_nodes_
Definition: torus_array_display.h:123
jsk_rviz_plugins::TorusArrayDisplay::auto_color_property_
rviz::BoolProperty * auto_color_property_
Definition: torus_array_display.h:114
jsk_rviz_plugins::TorusArrayDisplay::~TorusArrayDisplay
virtual ~TorusArrayDisplay()
Definition: torus_array_display.cpp:66
jsk_rviz_plugins::TorusArrayDisplay::alpha_property_
rviz::FloatProperty * alpha_property_
Definition: torus_array_display.h:112
jsk_rviz_plugins::TorusArrayDisplay::arrow_objects_
std::vector< ArrowPtr > arrow_objects_
Definition: torus_array_display.h:124
shape.h
float_property.h
rviz::ColorProperty
rviz::FloatProperty
jsk_rviz_plugins::Triangle::v2
unsigned v2
Definition: torus_array_display.h:121
jsk_rviz_plugins::TorusArrayDisplay::updateAutoColor
void updateAutoColor()
Definition: torus_array_display.cpp:118
jsk_rviz_plugins::TorusArrayDisplay::auto_color_
bool auto_color_
Definition: torus_array_display.h:119
bool_property.h
jsk_rviz_plugins::TorusArrayDisplay::updateAlpha
void updateAlpha()
Definition: torus_array_display.cpp:108
jsk_rviz_plugins::TorusArrayDisplay::onInitialize
virtual void onInitialize()
Definition: torus_array_display.cpp:88
jsk_rviz_plugins::TorusArrayDisplay::normal_length_property_
rviz::FloatProperty * normal_length_property_
Definition: torus_array_display.h:116
bounding_box_sample.q
q
Definition: bounding_box_sample.py:25
jsk_rviz_plugins::TorusArrayDisplay::updateNormalLength
void updateNormalLength()
Definition: torus_array_display.cpp:246
jsk_rviz_plugins::TorusArrayDisplay::color_property_
rviz::ColorProperty * color_property_
Definition: torus_array_display.h:111
message_filter_display.h
jsk_rviz_plugins::TorusArrayDisplay::updateShowNormal
void updateShowNormal()
Definition: torus_array_display.cpp:232
torus_array_sample.small_radius
small_radius
Definition: torus_array_sample.py:17
jsk_rviz_plugins::TorusArrayDisplay::reset
virtual void reset()
Definition: torus_array_display.cpp:123
jsk_rviz_plugins::TorusArrayDisplay::alpha_
double alpha_
Definition: torus_array_display.h:118
jsk_rviz_plugins::TorusArrayDisplay::ShapePtr
boost::shared_ptr< rviz::MeshShape > ShapePtr
Definition: torus_array_display.h:101
jsk_rviz_plugins::Triangle::v3
unsigned v3
Definition: torus_array_display.h:121
jsk_rviz_plugins::TorusArrayDisplay::uv_property_
rviz::IntProperty * uv_property_
Definition: torus_array_display.h:113
arrow.h
jsk_rviz_plugins::TorusArrayDisplay::show_normal_property_
rviz::BoolProperty * show_normal_property_
Definition: torus_array_display.h:115
torus_array_sample.large_radius
large_radius
Definition: torus_array_sample.py:16
jsk_rviz_plugins::TorusArrayDisplay::allocateShapes
void allocateShapes(const jsk_recognition_msgs::TorusArray::ConstPtr &msg)
Definition: torus_array_display.cpp:159
mesh_shape.h
jsk_rviz_plugins::TorusArrayDisplay::shapes_
std::vector< ShapePtr > shapes_
Definition: torus_array_display.h:125
jsk_rviz_plugins::TorusArrayDisplay::normal_length_
double normal_length_
Definition: torus_array_display.h:121
jsk_rviz_plugins::TorusArrayDisplay::ArrowPtr
boost::shared_ptr< rviz::Arrow > ArrowPtr
Definition: torus_array_display.h:100
jsk_rviz_plugins::TorusArrayDisplay::processMessage
void processMessage(const jsk_recognition_msgs::TorusArray::ConstPtr &msg)
Definition: torus_array_display.cpp:252
jsk_rviz_plugins::TorusArrayDisplay::uv_dimension_
int uv_dimension_
Definition: torus_array_display.h:122
jsk_rviz_plugins::TorusArrayDisplay::getColor
QColor getColor(size_t index)
Definition: torus_array_display.cpp:76
jsk_rviz_plugins
Definition: __init__.py:1
color_property.h
rviz::IntProperty


jsk_rviz_plugins
Author(s): Kei Okada , Yohei Kakiuchi , Shohei Fujii , Ryohei Ueda
autogenerated on Mon Jan 22 2024 03:47:13