textured_mesh_display.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Robot Operating System code by the University of Osnabrück
5  * Copyright (c) 2015, University of Osnabrück
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  * 1. Redistributions of source code must retain the above
13  * copyright notice, this list of conditions and the following
14  * disclaimer.
15  *
16  * 2. Redistributions in binary form must reproduce the above
17  * copyright notice, this list of conditions and the following
18  * disclaimer in the documentation and/or other materials provided
19  * with the distribution.
20  *
21  * 3. Neither the name of the copyright holder nor the names of its
22  * contributors may be used to endorse or promote products derived
23  * from this software without specific prior written permission.
24  *
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
30  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
33  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
34  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
35  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
36  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37  *
38  *
39  *
40  * textured_mesh_display.h
41  *
42  *
43  * authors:
44  *
45  * Sebastian Pütz <spuetz@uni-osnabrueck.de>
46  * Henning Deeken <hdeeken@uni-osnabrueck.de>
47  * Marcel Mrozinski
48  * Nils Oesting
49  * Kristin Schmidt <krschmidt@uni-osnabrueck.de>
50  * Jan Philipp Vogtherr <jvogtherr@uni-osnabrueck.de>
51  */
52 
53 #ifndef TEXTURED_MESH_DISPLAY_H
54 #define TEXTURED_MESH_DISPLAY_H
55 
56 #include "textured_mesh_visual.h"
57 
58 #include <mesh_msgs/MeshGeometryStamped.h>
59 #include <mesh_msgs/MeshGeometry.h>
60 #include <mesh_msgs/MeshVertexColorsStamped.h>
61 #include <mesh_msgs/MeshVertexColors.h>
62 #include <mesh_msgs/MeshVertexCostsStamped.h>
63 #include <mesh_msgs/MeshVertexCosts.h>
64 #include <mesh_msgs/MeshMaterialsStamped.h>
65 #include <mesh_msgs/MeshMaterials.h>
66 #include <mesh_msgs/MeshMaterial.h>
67 #include <mesh_msgs/MeshTexture.h>
68 
69 #include <sensor_msgs/Image.h>
70 
71 #include <rviz/display.h>
72 
73 #ifndef Q_MOC_RUN
76 #include <message_filters/cache.h>
77 
78 #include <tf2_ros/message_filter.h>
79 
80 #include <boost/circular_buffer.hpp>
81 
82 #endif
83 
84 namespace rviz
85 {
86 // Forward declaration
87 class BoolProperty;
88 class ColorProperty;
89 class FloatProperty;
90 class IntProperty;
91 class RosTopicProperty;
92 class EnumProperty;
93 class StringProperty;
94 
95 } // End namespace rviz
96 
97 namespace rviz_mesh_plugin
98 {
99 // Forward declaration
100 class TexturedMeshVisual;
101 
106 {
107  Q_OBJECT
108 public:
109  static size_t displayCounter;
110 
115 
120 
121 protected:
125  void onInitialize();
126 
130  void reset();
131 
135  void subscribe();
136 
140  void unsubscribe();
141 
145  void onEnable();
146 
150  void onDisable();
151 
155  void fixedFrameChanged();
156 
161  void incomingGeometry(const mesh_msgs::MeshGeometryStamped::ConstPtr& meshMsg);
162 
167  void incomingVertexColors(const mesh_msgs::MeshVertexColorsStamped::ConstPtr& colorsStamped);
168 
173  void incomingVertexCosts(const mesh_msgs::MeshVertexCostsStamped::ConstPtr& costsStamped);
174 
175 private Q_SLOTS:
176 
180  void updateMesh();
181 
185  void updateMeshBufferSize();
186 
190  void updateTopic();
191 
195  void initServices();
196 
201 
206 
210  void updateSynchronizer();
211 
215  void updateVertexCosts();
216 
217 private:
223 
229 
234  void cacheVertexCosts(const mesh_msgs::MeshVertexCostsStamped::ConstPtr costsStamped);
235 
240  void processMessage(const mesh_msgs::MeshGeometryStamped::ConstPtr& meshMsg);
241 
247  void requestVertexColors(boost::shared_ptr<TexturedMeshVisual> visual, std::string uuid);
248 
254  void requestMaterials(boost::shared_ptr<TexturedMeshVisual> visual, std::string uuid);
255 
259  void initialServiceCall();
260 
263 
266 
269 
272 
275 
278 
281 
284 
287 
290 
292  boost::circular_buffer<boost::shared_ptr<TexturedMeshVisual> > m_meshVisuals;
293 
296 
298  size_t m_displayID;
299 
301  std::string m_lastUuid;
302 
305 
308 
311 
314 
317 
320 
323 
326 
329 
332 
335 
338 
341 
344 
347 
350 
353 
356 
359 
362 
365 
368 
371 
374 
377 
380 
383 
386 
389 
392 
394  std::map<std::string, const mesh_msgs::MeshVertexCostsStamped::ConstPtr> m_costCache;
395 };
396 } // End namespace rviz_mesh_plugin
397 
398 #endif
rviz_mesh_plugin::TexturedMeshDisplay::m_vertexColorsSubscriber
message_filters::Subscriber< mesh_msgs::MeshVertexColorsStamped > m_vertexColorsSubscriber
Subscriber for vertex colors.
Definition: textured_mesh_display.h:265
rviz_mesh_plugin::TexturedMeshDisplay::m_selectVertexCostMap
rviz::EnumProperty * m_selectVertexCostMap
Property to select different types of vertex cost maps to be shown.
Definition: textured_mesh_display.h:379
rviz_mesh_plugin::TexturedMeshDisplay::m_costUseCustomLimits
rviz::BoolProperty * m_costUseCustomLimits
Property for using custom limits for cost display.
Definition: textured_mesh_display.h:385
rviz_mesh_plugin::TexturedMeshDisplay::m_lastUuid
std::string m_lastUuid
Uuid of the last received message.
Definition: textured_mesh_display.h:301
rviz_mesh_plugin::TexturedMeshDisplay::updateMeshBufferSize
void updateMeshBufferSize()
Sets capacity of trianglemesh_visual.
Definition: textured_mesh_display.cpp:590
rviz::RosTopicProperty
rviz_mesh_plugin::TexturedMeshDisplay::m_showWireframe
rviz::BoolProperty * m_showWireframe
Property to select the wireframe.
Definition: textured_mesh_display.h:355
rviz_mesh_plugin::TexturedMeshDisplay::getNewVisual
boost::shared_ptr< TexturedMeshVisual > getNewVisual()
Creates a new visual and returns shared pointer.
Definition: textured_mesh_display.cpp:779
tf2_ros::MessageFilter< mesh_msgs::MeshGeometryStamped >
rviz_mesh_plugin::TexturedMeshDisplay::m_meshCounter
size_t m_meshCounter
Counter for the meshes.
Definition: textured_mesh_display.h:295
boost::shared_ptr
rviz_mesh_plugin::TexturedMeshDisplay::m_uuidClient
ros::ServiceClient m_uuidClient
Client to request the UUID.
Definition: textured_mesh_display.h:370
rviz_mesh_plugin::TexturedMeshDisplay::onDisable
void onDisable()
Calls unsubscribe() and reset() if display is disabled.
Definition: textured_mesh_display.cpp:510
rviz_mesh_plugin::TexturedMeshDisplay
Class to show options in rviz window.
Definition: textured_mesh_display.h:105
rviz_mesh_plugin::TexturedMeshDisplay::m_vertexColorsTopic
rviz::RosTopicProperty * m_vertexColorsTopic
Property to handle topic for vertex colors.
Definition: textured_mesh_display.h:307
rviz_mesh_plugin::TexturedMeshDisplay::updateMaterialAndTextureServices
void updateMaterialAndTextureServices()
Updates the material and texture services.
Definition: textured_mesh_display.cpp:743
rviz_mesh_plugin::TexturedMeshDisplay::fixedFrameChanged
void fixedFrameChanged()
Sets the fixed frame.
Definition: textured_mesh_display.cpp:516
rviz_mesh_plugin::TexturedMeshDisplay::m_meshSubscriber
message_filters::Subscriber< mesh_msgs::MeshGeometryStamped > m_meshSubscriber
Subscriber for meshMsg.
Definition: textured_mesh_display.h:262
rviz::BoolProperty
message_filters::Cache< mesh_msgs::MeshGeometryStamped >
rviz_mesh_plugin::TexturedMeshDisplay::getCurrentVisual
boost::shared_ptr< TexturedMeshVisual > getCurrentVisual()
Creates a new visual and returns shared pointer.
Definition: textured_mesh_display.cpp:799
rviz_mesh_plugin::TexturedMeshDisplay::m_tfVertexCostsFilter
tf2_ros::MessageFilter< mesh_msgs::MeshVertexCostsStamped > * m_tfVertexCostsFilter
Messagefilter for vertex costs.
Definition: textured_mesh_display.h:277
rviz_mesh_plugin::TexturedMeshDisplay::m_meshVisuals
boost::circular_buffer< boost::shared_ptr< TexturedMeshVisual > > m_meshVisuals
Shared pointer to store the created objects of trianglemesh_visual.
Definition: textured_mesh_display.h:292
time_synchronizer.h
rviz_mesh_plugin::TexturedMeshDisplay::m_normalsColor
rviz::ColorProperty * m_normalsColor
Property to set the color of the normals.
Definition: textured_mesh_display.h:346
rviz_mesh_plugin::TexturedMeshDisplay::m_displayType
rviz::EnumProperty * m_displayType
Property to select the display type.
Definition: textured_mesh_display.h:352
rviz_mesh_plugin::TexturedMeshDisplay::subscribe
void subscribe()
Set the topics to subscribe.
Definition: textured_mesh_display.cpp:426
rviz_mesh_plugin::TexturedMeshDisplay::displayCounter
static size_t displayCounter
Definition: textured_mesh_display.h:109
display.h
rviz_mesh_plugin::TexturedMeshDisplay::m_facesAlpha
rviz::FloatProperty * m_facesAlpha
Property to set faces transparency.
Definition: textured_mesh_display.h:334
rviz_mesh_plugin::TexturedMeshDisplay::m_vertexCostsTopic
rviz::RosTopicProperty * m_vertexCostsTopic
Property to handle topic for vertex cost maps.
Definition: textured_mesh_display.h:310
rviz::ColorProperty
message_filters::Subscriber< mesh_msgs::MeshGeometryStamped >
rviz::Display
rviz::EnumProperty
rviz_mesh_plugin::TexturedMeshDisplay::m_wireframeColor
rviz::ColorProperty * m_wireframeColor
Property to set wireframe color.
Definition: textured_mesh_display.h:325
rviz_mesh_plugin::TexturedMeshDisplay::updateSynchronizer
void updateSynchronizer()
Updates the topic synchronizer.
rviz::FloatProperty
rviz_mesh_plugin::TexturedMeshDisplay::updateTopic
void updateTopic()
Updates the subscribed topic.
Definition: textured_mesh_display.cpp:418
rviz_mesh_plugin::TexturedMeshDisplay::m_colorsSynchronizer
message_filters::Cache< mesh_msgs::MeshVertexColorsStamped > * m_colorsSynchronizer
Synchronizer for vertex colors.
Definition: textured_mesh_display.h:283
rviz_mesh_plugin::TexturedMeshDisplay::reset
void reset()
Clears whole stored data.
Definition: textured_mesh_display.cpp:410
message_filter.h
rviz_mesh_plugin::TexturedMeshDisplay::requestMaterials
void requestMaterials(boost::shared_ptr< TexturedMeshVisual > visual, std::string uuid)
Requests materials from the specified service.
Definition: textured_mesh_display.cpp:865
rviz_mesh_plugin::TexturedMeshDisplay::m_textureServiceName
rviz::StringProperty * m_textureServiceName
Property to handle service name for textures.
Definition: textured_mesh_display.h:319
rviz_mesh_plugin::TexturedMeshDisplay::incomingVertexColors
void incomingVertexColors(const mesh_msgs::MeshVertexColorsStamped::ConstPtr &colorsStamped)
Handler for incoming vertex color messages. Validate data and update mesh.
Definition: textured_mesh_display.cpp:522
rviz
subscriber.h
rviz_mesh_plugin::TexturedMeshDisplay::m_facesTriangleColors
rviz::BoolProperty * m_facesTriangleColors
Property to use the triangle colors.
Definition: textured_mesh_display.h:340
rviz::StringProperty
rviz_mesh_plugin::TexturedMeshDisplay::initialServiceCall
void initialServiceCall()
initial service call for UUID & geometry
Definition: textured_mesh_display.cpp:376
cache.h
rviz_mesh_plugin::TexturedMeshDisplay::unsubscribe
void unsubscribe()
Unsubscribes all topics.
Definition: textured_mesh_display.cpp:482
rviz_mesh_plugin::TexturedMeshDisplay::onEnable
void onEnable()
Calls subscribe() if display is enabled.
Definition: textured_mesh_display.cpp:505
rviz_mesh_plugin::TexturedMeshDisplay::m_vertexColorClient
ros::ServiceClient m_vertexColorClient
Client to request the vertex colors.
Definition: textured_mesh_display.h:361
rviz_mesh_plugin::TexturedMeshDisplay::m_geometryClient
ros::ServiceClient m_geometryClient
Client to request the geometry.
Definition: textured_mesh_display.h:373
rviz_mesh_plugin::TexturedMeshDisplay::updateVertexColorService
void updateVertexColorService()
Updates the vertex color service.
Definition: textured_mesh_display.cpp:716
rviz_mesh_plugin::TexturedMeshDisplay::m_costColorType
rviz::EnumProperty * m_costColorType
Property for selecting the color type for cost display.
Definition: textured_mesh_display.h:382
rviz_mesh_plugin::TexturedMeshDisplay::m_showTexturedFacesOnly
rviz::BoolProperty * m_showTexturedFacesOnly
Property to only show textured faces when texturizing is enabled.
Definition: textured_mesh_display.h:376
ros::ServiceClient
rviz_mesh_plugin::TexturedMeshDisplay::cacheVertexCosts
void cacheVertexCosts(const mesh_msgs::MeshVertexCostsStamped::ConstPtr costsStamped)
Cache function for vertex cost messages.
Definition: textured_mesh_display.cpp:557
rviz_mesh_plugin::TexturedMeshDisplay::m_meshTopic
rviz::RosTopicProperty * m_meshTopic
Property to handle topic for meshMsg.
Definition: textured_mesh_display.h:304
rviz_mesh_plugin::TexturedMeshDisplay::m_facesColor
rviz::ColorProperty * m_facesColor
Property to set faces color.
Definition: textured_mesh_display.h:331
rviz_mesh_plugin::TexturedMeshDisplay::m_tfMeshFilter
tf2_ros::MessageFilter< mesh_msgs::MeshGeometryStamped > * m_tfMeshFilter
Messagefilter for meshMsg.
Definition: textured_mesh_display.h:271
rviz_mesh_plugin::TexturedMeshDisplay::m_meshSynchronizer
message_filters::Cache< mesh_msgs::MeshGeometryStamped > * m_meshSynchronizer
Synchronizer for meshMsgs.
Definition: textured_mesh_display.h:280
rviz_mesh_plugin::TexturedMeshDisplay::incomingVertexCosts
void incomingVertexCosts(const mesh_msgs::MeshVertexCostsStamped::ConstPtr &costsStamped)
Handler for incoming vertex cost messages. Validate data and update mesh.
Definition: textured_mesh_display.cpp:540
rviz_mesh_plugin::TexturedMeshDisplay::m_tfVertexColorsFilter
tf2_ros::MessageFilter< mesh_msgs::MeshVertexColorsStamped > * m_tfVertexColorsFilter
Messagefilter for vertex colors.
Definition: textured_mesh_display.h:274
rviz_mesh_plugin::TexturedMeshDisplay::m_materialServiceName
rviz::StringProperty * m_materialServiceName
Property to handle service name for materials.
Definition: textured_mesh_display.h:316
rviz_mesh_plugin::TexturedMeshDisplay::updateMesh
void updateMesh()
Updates material for each mesh displayed by trianglemesh_visual.
Definition: textured_mesh_display.cpp:630
rviz_mesh_plugin::TexturedMeshDisplay::m_meshBufferSize
rviz::IntProperty * m_meshBufferSize
Property to set meshBufferSize.
Definition: textured_mesh_display.h:322
rviz_mesh_plugin::TexturedMeshDisplay::m_costLowerLimit
rviz::FloatProperty * m_costLowerLimit
Property for setting the lower limit of cost display.
Definition: textured_mesh_display.h:388
rviz_mesh_plugin
Definition: face_selection_tool.h:117
rviz_mesh_plugin::TexturedMeshDisplay::m_displayID
size_t m_displayID
DisplayID.
Definition: textured_mesh_display.h:298
rviz_mesh_plugin::TexturedMeshDisplay::m_facesVertexColors
rviz::BoolProperty * m_facesVertexColors
Property to use the vertex colors.
Definition: textured_mesh_display.h:337
rviz_mesh_plugin::TexturedMeshDisplay::updateVertexCosts
void updateVertexCosts()
Update the vertex costs.
Definition: textured_mesh_display.cpp:596
rviz_mesh_plugin::TexturedMeshDisplay::m_vertexColorServiceName
rviz::StringProperty * m_vertexColorServiceName
Property to handle service name for vertexColors.
Definition: textured_mesh_display.h:313
rviz_mesh_plugin::TexturedMeshDisplay::incomingGeometry
void incomingGeometry(const mesh_msgs::MeshGeometryStamped::ConstPtr &meshMsg)
Handler for incoming geometry messages. Validate data and update mesh.
Definition: textured_mesh_display.cpp:583
rviz_mesh_plugin::TexturedMeshDisplay::TexturedMeshDisplay
TexturedMeshDisplay()
Constructor.
Definition: textured_mesh_display.cpp:89
rviz_mesh_plugin::TexturedMeshDisplay::requestVertexColors
void requestVertexColors(boost::shared_ptr< TexturedMeshVisual > visual, std::string uuid)
Requests vertex colors from the specified service.
Definition: textured_mesh_display.cpp:847
rviz_mesh_plugin::TexturedMeshDisplay::m_wireframeAlpha
rviz::FloatProperty * m_wireframeAlpha
Property to set wireframe transparency.
Definition: textured_mesh_display.h:328
rviz_mesh_plugin::TexturedMeshDisplay::m_textureClient
ros::ServiceClient m_textureClient
Client to request the textures.
Definition: textured_mesh_display.h:367
rviz_mesh_plugin::TexturedMeshDisplay::m_scalingFactor
rviz::FloatProperty * m_scalingFactor
Property to set the size of the normals.
Definition: textured_mesh_display.h:343
rviz_mesh_plugin::TexturedMeshDisplay::m_vertexCostsSubscriber
message_filters::Subscriber< mesh_msgs::MeshVertexCostsStamped > m_vertexCostsSubscriber
Subscriber for vertex costs.
Definition: textured_mesh_display.h:268
rviz_mesh_plugin::TexturedMeshDisplay::m_costUpperLimit
rviz::FloatProperty * m_costUpperLimit
Property for setting the upper limit of cost display.
Definition: textured_mesh_display.h:391
textured_mesh_visual.h
rviz_mesh_plugin::TexturedMeshDisplay::m_costCache
std::map< std::string, const mesh_msgs::MeshVertexCostsStamped::ConstPtr > m_costCache
Cache for received vertex cost messages.
Definition: textured_mesh_display.h:394
rviz_mesh_plugin::TexturedMeshDisplay::m_showNormals
rviz::BoolProperty * m_showNormals
Property to select the normals.
Definition: textured_mesh_display.h:358
rviz_mesh_plugin::TexturedMeshDisplay::initServices
void initServices()
Initializes the used services.
Definition: textured_mesh_display.cpp:705
rviz_mesh_plugin::TexturedMeshDisplay::processMessage
void processMessage(const mesh_msgs::MeshGeometryStamped::ConstPtr &meshMsg)
Sets data for trianglemesh_visual and updates the mesh.
Definition: textured_mesh_display.cpp:810
rviz_mesh_plugin::TexturedMeshDisplay::m_costsSynchronizer
message_filters::Cache< mesh_msgs::MeshVertexCostsStamped > * m_costsSynchronizer
Synchronizer for vertex costs.
Definition: textured_mesh_display.h:286
rviz_mesh_plugin::TexturedMeshDisplay::m_messagesReceived
uint32_t m_messagesReceived
Counter for the received messages.
Definition: textured_mesh_display.h:289
rviz_mesh_plugin::TexturedMeshDisplay::m_normalsAlpha
rviz::FloatProperty * m_normalsAlpha
Property to set the transparency of the normals.
Definition: textured_mesh_display.h:349
rviz_mesh_plugin::TexturedMeshDisplay::onInitialize
void onInitialize()
Initialises all nessessary things to get started.
Definition: textured_mesh_display.cpp:337
rviz::IntProperty
rviz_mesh_plugin::TexturedMeshDisplay::~TexturedMeshDisplay
~TexturedMeshDisplay()
Destructor.
Definition: textured_mesh_display.cpp:331
rviz_mesh_plugin::TexturedMeshDisplay::m_materialsClient
ros::ServiceClient m_materialsClient
Client to request the materials.
Definition: textured_mesh_display.h:364


rviz_mesh_plugin
Author(s): Sebastian Pütz , Henning Deeken , Marcel Mrozinski , Kristin Schmidt , Jan Philipp Vogtherr
autogenerated on Fri Feb 12 2021 04:03:57