Public Member Functions | Private Member Functions | Private Attributes | List of all members
rviz_mesh_plugin::TexturedMeshVisual Class Reference

Class to display mesh data in the main panel of rviz. More...

#include <textured_mesh_visual.h>

Public Member Functions

bool addTexture (const mesh_msgs::MeshTexture::ConstPtr &textureMsg)
 Extracts data from the ros-messages and adds textures to the textured mesh. More...
 
void reset ()
 Clears whole stored data. More...
 
void setFrameOrientation (const Ogre::Quaternion &orientation)
 Sets the orientation of the coordinate frame the message refers to. More...
 
void setFramePosition (const Ogre::Vector3 &position)
 Sets the pose of the coordinate frame the message refers to. More...
 
bool setGeometry (const mesh_msgs::MeshGeometryStamped::ConstPtr &meshMsg)
 Extracts data from the ros-messages and creates meshes. More...
 
bool setMaterials (const mesh_msgs::MeshMaterialsStamped::ConstPtr &materialMsg)
 Extracts data from the ros-messages and creates a textured mesh. More...
 
bool setVertexColors (const mesh_msgs::MeshVertexColorsStamped::ConstPtr &vertexColorsMsg)
 Extracts data from the ros-messages and creates a colored mesh. More...
 
bool setVertexCosts (const mesh_msgs::MeshVertexCostsStamped::ConstPtr &vertexCostsMsg, int costColorType)
 Extracts data from the ros-messages and creates a colored mesh with colors calculated from vertex costs. More...
 
bool setVertexCosts (const mesh_msgs::MeshVertexCostsStamped::ConstPtr &vertexCostsMsg, int costColorType, float minCost, float maxCost)
 
 TexturedMeshVisual (rviz::DisplayContext *context, size_t displayID, size_t meshID, size_t randomID)
 Constructor. More...
 
void updateMaterial (bool showWireframe, Ogre::ColourValue wireframeColor, float wireframeAlpha, bool showFaces, Ogre::ColourValue facesColor, float facesAlpha, bool useVertexColors, bool showVertexCosts, bool showTextures, bool showTexturedFacesOnly, bool showNormals, Ogre::ColourValue normalsColor, float normalsAlpha, float normalsScallingFactor)
 Updates the visible parts of the mesh depending on input from the rviz display. More...
 
void updateNormals (float scallingFactor)
 Updates the size of the normals dynamically. More...
 
virtual ~TexturedMeshVisual ()
 Destructor. More...
 

Private Member Functions

Ogre::ColourValue calculateColorFromCost (float cost, int costColorType)
 Calculates a color for a given cost value using a spectrum from red to green. More...
 
void enteringColoredTriangleMesh (const mesh_msgs::MeshGeometry &mesh, const mesh_msgs::MeshVertexColors &vertexColors)
 
void enteringGeneralTriangleMesh (const mesh_msgs::MeshGeometry &mesh)
 
void enteringNormals (const mesh_msgs::MeshGeometry &mesh)
 
void enteringTexturedTriangleMesh (const mesh_msgs::MeshGeometry &mesh, const mesh_msgs::MeshMaterials &meshMaterials)
 
void enteringTriangleMeshWithVertexCosts (const mesh_msgs::MeshGeometry &mesh, const mesh_msgs::MeshVertexCosts &vertexCosts, int costColorType)
 
void enteringTriangleMeshWithVertexCosts (const mesh_msgs::MeshGeometry &mesh, const mesh_msgs::MeshVertexCosts &vertexCosts, int costColorType, float minCost, float maxCost)
 
Ogre::PixelFormat getOgrePixelFormatFromRosString (std::string encoding)
 
void loadImageIntoTextureMaterial (size_t textureIndex)
 
void showFaces (Ogre::Pass *pass, Ogre::ColourValue facesColor, float facesAlpha, bool useVertexColors)
 
void showNormals (Ogre::Pass *pass, Ogre::ColourValue normalsColor, float normalsAlpha)
 
void showTextures (Ogre::Pass *pass)
 
void showWireframe (Ogre::Pass *pass, Ogre::ColourValue wireframeColor, float wireframeAlpha)
 Enables the wireframe. More...
 

Private Attributes

rviz::DisplayContextm_displayContext
 The context that contains the display information. More...
 
std::vector< Ogre::Image > m_images
 
bool m_materials_enabled
 
std::string m_materialsUuid
 Uuid of the currently shown materials. More...
 
Ogre::ManualObject * m_mesh
 The mesh-object to display. More...
 
Ogre::MaterialPtr m_meshGeneralMaterial
 The material for the general mesh. More...
 
mesh_msgs::MeshGeometry m_meshMsg
 Triangle Mesh contained in the given message. More...
 
Ogre::MaterialPtr m_meshTexturedTrianglesMaterial
 The material for the textured triangle mesh. More...
 
std::string m_meshUuid
 Uuid of the currently shown vertex colors. More...
 
Ogre::MaterialPtr m_normalMaterial
 The material of the normals. More...
 
Ogre::ManualObject * m_normals
 The manual object to display normals. More...
 
float m_normalsScalingFactor
 Factor the normal-size is multiplied with. More...
 
Ogre::MaterialPtr m_noTexCluMaterial
 The materials of the not textured clusters. More...
 
Ogre::ManualObject * m_noTexCluMesh
 The manual object to display the not textured parts of the textured mesh. More...
 
size_t m_postfix
 Second ID of the created mesh. More...
 
size_t m_prefix
 First ID of the created mesh. More...
 
size_t m_random
 Random ID of the created mesh. More...
 
Ogre::SceneNode * m_sceneNode
 Ogre Scenenode. More...
 
bool m_texture_coords_enabled
 
Ogre::ManualObject * m_texturedMesh
 The manual object to display the textured mesh. More...
 
Ogre::MaterialPtr m_texturedMeshMaterial
 
std::vector< Ogre::MaterialPtr > m_textureMaterials
 The materials of the textures. More...
 
bool m_textures_enabled
 
bool m_vertex_colors_enabled
 
bool m_vertex_costs_enabled
 
bool m_vertex_normals_enabled
 
std::string m_vertexColorsUuid
 Uuid of the currently shown vertex colors. More...
 
Ogre::MaterialPtr m_vertexCostMaterial
 The material of the mesh with vertex costs. More...
 
Ogre::ManualObject * m_vertexCostsMesh
 The manual object to display the mesh with vertex costs. More...
 
std::string m_vertexCostsUuid
 Uuid of the currently shown vertex costs. More...
 

Detailed Description

Class to display mesh data in the main panel of rviz.

Definition at line 94 of file textured_mesh_visual.h.

Constructor & Destructor Documentation

◆ TexturedMeshVisual()

rviz_mesh_plugin::TexturedMeshVisual::TexturedMeshVisual ( rviz::DisplayContext context,
size_t  displayID,
size_t  meshID,
size_t  randomID 
)

Constructor.

Parameters
contextThe context that contains the display information.
displayIDThe display id
meshIDThe mesh id
randomIDrandom number that will be used as part of the meshes UID

Definition at line 44 of file textured_mesh_visual.cpp.

◆ ~TexturedMeshVisual()

rviz_mesh_plugin::TexturedMeshVisual::~TexturedMeshVisual ( )
virtual

Destructor.

Definition at line 112 of file textured_mesh_visual.cpp.

Member Function Documentation

◆ addTexture()

bool rviz_mesh_plugin::TexturedMeshVisual::addTexture ( const mesh_msgs::MeshTexture::ConstPtr &  textureMsg)

Extracts data from the ros-messages and adds textures to the textured mesh.

Parameters
textureMsgMessage containing the texture information

Definition at line 1088 of file textured_mesh_visual.cpp.

◆ calculateColorFromCost()

Ogre::ColourValue rviz_mesh_plugin::TexturedMeshVisual::calculateColorFromCost ( float  cost,
int  costColorType 
)
private

Calculates a color for a given cost value using a spectrum from red to green.

Parameters
costThe cost value (should be within the range 0 - 1)
Returns
calculated color

Definition at line 1167 of file textured_mesh_visual.cpp.

◆ enteringColoredTriangleMesh()

void rviz_mesh_plugin::TexturedMeshVisual::enteringColoredTriangleMesh ( const mesh_msgs::MeshGeometry &  mesh,
const mesh_msgs::MeshVertexColors &  vertexColors 
)
private

Definition at line 493 of file textured_mesh_visual.cpp.

◆ enteringGeneralTriangleMesh()

void rviz_mesh_plugin::TexturedMeshVisual::enteringGeneralTriangleMesh ( const mesh_msgs::MeshGeometry &  mesh)
private

Definition at line 439 of file textured_mesh_visual.cpp.

◆ enteringNormals()

void rviz_mesh_plugin::TexturedMeshVisual::enteringNormals ( const mesh_msgs::MeshGeometry &  mesh)
private

Definition at line 832 of file textured_mesh_visual.cpp.

◆ enteringTexturedTriangleMesh()

void rviz_mesh_plugin::TexturedMeshVisual::enteringTexturedTriangleMesh ( const mesh_msgs::MeshGeometry &  mesh,
const mesh_msgs::MeshMaterials &  meshMaterials 
)
private

Definition at line 654 of file textured_mesh_visual.cpp.

◆ enteringTriangleMeshWithVertexCosts() [1/2]

void rviz_mesh_plugin::TexturedMeshVisual::enteringTriangleMeshWithVertexCosts ( const mesh_msgs::MeshGeometry &  mesh,
const mesh_msgs::MeshVertexCosts &  vertexCosts,
int  costColorType 
)
private

Definition at line 556 of file textured_mesh_visual.cpp.

◆ enteringTriangleMeshWithVertexCosts() [2/2]

void rviz_mesh_plugin::TexturedMeshVisual::enteringTriangleMeshWithVertexCosts ( const mesh_msgs::MeshGeometry &  mesh,
const mesh_msgs::MeshVertexCosts &  vertexCosts,
int  costColorType,
float  minCost,
float  maxCost 
)
private

Definition at line 575 of file textured_mesh_visual.cpp.

◆ getOgrePixelFormatFromRosString()

Ogre::PixelFormat rviz_mesh_plugin::TexturedMeshVisual::getOgrePixelFormatFromRosString ( std::string  encoding)
private

Definition at line 1130 of file textured_mesh_visual.cpp.

◆ loadImageIntoTextureMaterial()

void rviz_mesh_plugin::TexturedMeshVisual::loadImageIntoTextureMaterial ( size_t  textureIndex)
private

Definition at line 1145 of file textured_mesh_visual.cpp.

◆ reset()

void rviz_mesh_plugin::TexturedMeshVisual::reset ( )

Clears whole stored data.

Definition at line 143 of file textured_mesh_visual.cpp.

◆ setFrameOrientation()

void rviz_mesh_plugin::TexturedMeshVisual::setFrameOrientation ( const Ogre::Quaternion &  orientation)

Sets the orientation of the coordinate frame the message refers to.

Parameters
orientationThe orientation of the coordinate frame

Definition at line 1197 of file textured_mesh_visual.cpp.

◆ setFramePosition()

void rviz_mesh_plugin::TexturedMeshVisual::setFramePosition ( const Ogre::Vector3 &  position)

Sets the pose of the coordinate frame the message refers to.

Parameters
positionThe pose of the coordinate frame

Definition at line 1192 of file textured_mesh_visual.cpp.

◆ setGeometry()

bool rviz_mesh_plugin::TexturedMeshVisual::setGeometry ( const mesh_msgs::MeshGeometryStamped::ConstPtr &  meshMsg)

Extracts data from the ros-messages and creates meshes.

Parameters
meshMsgMessage containing the mesh

Definition at line 869 of file textured_mesh_visual.cpp.

◆ setMaterials()

bool rviz_mesh_plugin::TexturedMeshVisual::setMaterials ( const mesh_msgs::MeshMaterialsStamped::ConstPtr &  materialMsg)

Extracts data from the ros-messages and creates a textured mesh.

Parameters
materialMsgMessage containing the material information

Definition at line 1039 of file textured_mesh_visual.cpp.

◆ setVertexColors()

bool rviz_mesh_plugin::TexturedMeshVisual::setVertexColors ( const mesh_msgs::MeshVertexColorsStamped::ConstPtr &  vertexColorsMsg)

Extracts data from the ros-messages and creates a colored mesh.

Parameters
vertexColorsMsgMessage containing the vertex color information

Definition at line 935 of file textured_mesh_visual.cpp.

◆ setVertexCosts() [1/2]

bool rviz_mesh_plugin::TexturedMeshVisual::setVertexCosts ( const mesh_msgs::MeshVertexCostsStamped::ConstPtr &  vertexCostsMsg,
int  costColorType 
)

Extracts data from the ros-messages and creates a colored mesh with colors calculated from vertex costs.

Parameters
vertexCostsMsgMessage containing the vertex cost information

Definition at line 971 of file textured_mesh_visual.cpp.

◆ setVertexCosts() [2/2]

bool rviz_mesh_plugin::TexturedMeshVisual::setVertexCosts ( const mesh_msgs::MeshVertexCostsStamped::ConstPtr &  vertexCostsMsg,
int  costColorType,
float  minCost,
float  maxCost 
)

Definition at line 1004 of file textured_mesh_visual.cpp.

◆ showFaces()

void rviz_mesh_plugin::TexturedMeshVisual::showFaces ( Ogre::Pass *  pass,
Ogre::ColourValue  facesColor,
float  facesAlpha,
bool  useVertexColors 
)
private

Definition at line 250 of file textured_mesh_visual.cpp.

◆ showNormals()

void rviz_mesh_plugin::TexturedMeshVisual::showNormals ( Ogre::Pass *  pass,
Ogre::ColourValue  normalsColor,
float  normalsAlpha 
)
private

Definition at line 283 of file textured_mesh_visual.cpp.

◆ showTextures()

void rviz_mesh_plugin::TexturedMeshVisual::showTextures ( Ogre::Pass *  pass)
private

◆ showWireframe()

void rviz_mesh_plugin::TexturedMeshVisual::showWireframe ( Ogre::Pass *  pass,
Ogre::ColourValue  wireframeColor,
float  wireframeAlpha 
)
private

Enables the wireframe.

Parameters
passOgre Pass
wireframeColorThe color of the wireframe
wireframeAlphaTransparency of the wireframe

Definition at line 218 of file textured_mesh_visual.cpp.

◆ updateMaterial()

void rviz_mesh_plugin::TexturedMeshVisual::updateMaterial ( bool  showWireframe,
Ogre::ColourValue  wireframeColor,
float  wireframeAlpha,
bool  showFaces,
Ogre::ColourValue  facesColor,
float  facesAlpha,
bool  useVertexColors,
bool  showVertexCosts,
bool  showTextures,
bool  showTexturedFacesOnly,
bool  showNormals,
Ogre::ColourValue  normalsColor,
float  normalsAlpha,
float  normalsScallingFactor 
)

Updates the visible parts of the mesh depending on input from the rviz display.

Parameters
showWireframeWhen TRUE wireframe is visible
wireframeColorThe color of the wireframe
wireframeAlphaThe transparency of the wireframe
showFacesWhen TRUE faces are visible
facesColorThe color of the faces
facesAlphaThe transparency of the faces
useVertexColorsWhen TRUE vertex colors are used
showVertexCostsWhen TRUE vertex costs are visible
showTexturesWhen TRUE textures are visible
showNormalsWhen TRUE normals are visible
normalsColorThe color of the normals
normalsAlphaThe transparency of the normals
normalsScallingFactorThe size of the normals

Definition at line 308 of file textured_mesh_visual.cpp.

◆ updateNormals()

void rviz_mesh_plugin::TexturedMeshVisual::updateNormals ( float  scallingFactor)

Updates the size of the normals dynamically.

Parameters
scallingFactorThe factor the normals have to be scaled with

Definition at line 384 of file textured_mesh_visual.cpp.

Member Data Documentation

◆ m_displayContext

rviz::DisplayContext* rviz_mesh_plugin::TexturedMeshVisual::m_displayContext
private

The context that contains the display information.

Definition at line 252 of file textured_mesh_visual.h.

◆ m_images

std::vector<Ogre::Image> rviz_mesh_plugin::TexturedMeshVisual::m_images
private

Definition at line 279 of file textured_mesh_visual.h.

◆ m_materials_enabled

bool rviz_mesh_plugin::TexturedMeshVisual::m_materials_enabled
private

Definition at line 244 of file textured_mesh_visual.h.

◆ m_materialsUuid

std::string rviz_mesh_plugin::TexturedMeshVisual::m_materialsUuid
private

Uuid of the currently shown materials.

Definition at line 318 of file textured_mesh_visual.h.

◆ m_mesh

Ogre::ManualObject* rviz_mesh_plugin::TexturedMeshVisual::m_mesh
private

The mesh-object to display.

Definition at line 264 of file textured_mesh_visual.h.

◆ m_meshGeneralMaterial

Ogre::MaterialPtr rviz_mesh_plugin::TexturedMeshVisual::m_meshGeneralMaterial
private

The material for the general mesh.

Definition at line 285 of file textured_mesh_visual.h.

◆ m_meshMsg

mesh_msgs::MeshGeometry rviz_mesh_plugin::TexturedMeshVisual::m_meshMsg
private

Triangle Mesh contained in the given message.

Definition at line 306 of file textured_mesh_visual.h.

◆ m_meshTexturedTrianglesMaterial

Ogre::MaterialPtr rviz_mesh_plugin::TexturedMeshVisual::m_meshTexturedTrianglesMaterial
private

The material for the textured triangle mesh.

Definition at line 288 of file textured_mesh_visual.h.

◆ m_meshUuid

std::string rviz_mesh_plugin::TexturedMeshVisual::m_meshUuid
private

Uuid of the currently shown vertex colors.

Definition at line 309 of file textured_mesh_visual.h.

◆ m_normalMaterial

Ogre::MaterialPtr rviz_mesh_plugin::TexturedMeshVisual::m_normalMaterial
private

The material of the normals.

Definition at line 291 of file textured_mesh_visual.h.

◆ m_normals

Ogre::ManualObject* rviz_mesh_plugin::TexturedMeshVisual::m_normals
private

The manual object to display normals.

Definition at line 267 of file textured_mesh_visual.h.

◆ m_normalsScalingFactor

float rviz_mesh_plugin::TexturedMeshVisual::m_normalsScalingFactor
private

Factor the normal-size is multiplied with.

Definition at line 303 of file textured_mesh_visual.h.

◆ m_noTexCluMaterial

Ogre::MaterialPtr rviz_mesh_plugin::TexturedMeshVisual::m_noTexCluMaterial
private

The materials of the not textured clusters.

Definition at line 294 of file textured_mesh_visual.h.

◆ m_noTexCluMesh

Ogre::ManualObject* rviz_mesh_plugin::TexturedMeshVisual::m_noTexCluMesh
private

The manual object to display the not textured parts of the textured mesh.

Definition at line 276 of file textured_mesh_visual.h.

◆ m_postfix

size_t rviz_mesh_plugin::TexturedMeshVisual::m_postfix
private

Second ID of the created mesh.

Definition at line 258 of file textured_mesh_visual.h.

◆ m_prefix

size_t rviz_mesh_plugin::TexturedMeshVisual::m_prefix
private

First ID of the created mesh.

Definition at line 255 of file textured_mesh_visual.h.

◆ m_random

size_t rviz_mesh_plugin::TexturedMeshVisual::m_random
private

Random ID of the created mesh.

Definition at line 261 of file textured_mesh_visual.h.

◆ m_sceneNode

Ogre::SceneNode* rviz_mesh_plugin::TexturedMeshVisual::m_sceneNode
private

Ogre Scenenode.

Definition at line 249 of file textured_mesh_visual.h.

◆ m_texture_coords_enabled

bool rviz_mesh_plugin::TexturedMeshVisual::m_texture_coords_enabled
private

Definition at line 245 of file textured_mesh_visual.h.

◆ m_texturedMesh

Ogre::ManualObject* rviz_mesh_plugin::TexturedMeshVisual::m_texturedMesh
private

The manual object to display the textured mesh.

Definition at line 273 of file textured_mesh_visual.h.

◆ m_texturedMeshMaterial

Ogre::MaterialPtr rviz_mesh_plugin::TexturedMeshVisual::m_texturedMeshMaterial
private

Definition at line 282 of file textured_mesh_visual.h.

◆ m_textureMaterials

std::vector<Ogre::MaterialPtr> rviz_mesh_plugin::TexturedMeshVisual::m_textureMaterials
private

The materials of the textures.

Definition at line 300 of file textured_mesh_visual.h.

◆ m_textures_enabled

bool rviz_mesh_plugin::TexturedMeshVisual::m_textures_enabled
private

Definition at line 246 of file textured_mesh_visual.h.

◆ m_vertex_colors_enabled

bool rviz_mesh_plugin::TexturedMeshVisual::m_vertex_colors_enabled
private

Definition at line 242 of file textured_mesh_visual.h.

◆ m_vertex_costs_enabled

bool rviz_mesh_plugin::TexturedMeshVisual::m_vertex_costs_enabled
private

Definition at line 243 of file textured_mesh_visual.h.

◆ m_vertex_normals_enabled

bool rviz_mesh_plugin::TexturedMeshVisual::m_vertex_normals_enabled
private

Definition at line 241 of file textured_mesh_visual.h.

◆ m_vertexColorsUuid

std::string rviz_mesh_plugin::TexturedMeshVisual::m_vertexColorsUuid
private

Uuid of the currently shown vertex colors.

Definition at line 312 of file textured_mesh_visual.h.

◆ m_vertexCostMaterial

Ogre::MaterialPtr rviz_mesh_plugin::TexturedMeshVisual::m_vertexCostMaterial
private

The material of the mesh with vertex costs.

Definition at line 297 of file textured_mesh_visual.h.

◆ m_vertexCostsMesh

Ogre::ManualObject* rviz_mesh_plugin::TexturedMeshVisual::m_vertexCostsMesh
private

The manual object to display the mesh with vertex costs.

Definition at line 270 of file textured_mesh_visual.h.

◆ m_vertexCostsUuid

std::string rviz_mesh_plugin::TexturedMeshVisual::m_vertexCostsUuid
private

Uuid of the currently shown vertex costs.

Definition at line 315 of file textured_mesh_visual.h.


The documentation for this class was generated from the following files:


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