moveit2
The MoveIt Motion Planning Framework for ROS 2.
Loading...
Searching...
No Matches
mesh_filter::MeshFilter< SensorType > Class Template Reference

MeshFilter filters out points that belong to given meshes in depth-images. More...

#include <mesh_filter.hpp>

Inheritance diagram for mesh_filter::MeshFilter< SensorType >:
Collaboration diagram for mesh_filter::MeshFilter< SensorType >:

Public Member Functions

 MOVEIT_DECLARE_PTR_MEMBER (MeshFilter)
 MeshFilter (const TransformCallback &transform_callback=TransformCallback(), const typename SensorType::Parameters &sensor_parameters=typename SensorType::Parameters())
 Constructor.
SensorType::Parameters & parameters ()
 returns the Sensor Parameters
const SensorType::Parameters & parameters () const
 returns the Sensor Parameters
Public Member Functions inherited from mesh_filter::MeshFilterBase
 MeshFilterBase (const TransformCallback &transform_callback, const SensorModel::Parameters &sensor_parameters, const std::string &render_vertex_shader="", const std::string &render_fragment_shader="", const std::string &filter_vertex_shader="", const std::string &filter_fragment_shader="")
 Constructor.
 ~MeshFilterBase ()
 Destructor.
MeshHandle addMesh (const shapes::Mesh &mesh)
 adds a mesh to the filter object.
void removeMesh (MeshHandle mesh_handle)
 removes a mesh given by its handle
void filter (const void *sensor_data, GLushort type, bool wait=false) const
 label/remove pixels from input depth-image
void getFilteredLabels (LabelType *labels) const
 retrieves the labels of the input data
void getFilteredDepth (float *depth) const
 retrieves the filtered depth values
void getModelLabels (LabelType *labels) const
 retrieves the labels of the rendered model
void getModelDepth (float *depth) const
 retrieves the depth values of the rendered model
void setShadowThreshold (float threshold)
 set the shadow threshold. points that are further away than the rendered model are filtered out. Except they are further away than this threshold. Then these points are kept, but its label is set to 1 indicating that it is in the shadow of the model
void setTransformCallback (const TransformCallback &transform_callback)
 set the callback for retrieving transformations for each mesh.
void setPaddingScale (float scale)
 set the scale component of padding used to multiply with sensor-specific padding coefficients to get final coefficients.
void setPaddingOffset (float offset)
 set the offset component of padding. This value is added to the scaled sensor-specific constant component.

Additional Inherited Members

Public Types inherited from mesh_filter::MeshFilterBase
enum  {
  BACKGROUND = 0 , SHADOW = 1 , NEAR_CLIP = 2 , FAR_CLIP = 3 ,
  FIRST_LABEL = 16
}
typedef std::function< bool(MeshHandle, Eigen::Isometry3d &)> TransformCallback
Protected Member Functions inherited from mesh_filter::MeshFilterBase
void initialize (const std::string &render_vertex_shader, const std::string &render_fragment_shader, const std::string &filter_vertex_shader, const std::string &filter_fragment_shader)
 initializes OpenGL related things as well as renderers
void deInitialize ()
 cleaning up
void run (const std::string &render_vertex_shader, const std::string &render_fragment_shader, const std::string &filter_vertex_shader, const std::string &filter_fragment_shader)
 filtering thread
void doFilter (const void *sensor_data, const int encoding) const
 the filter method that does the magic
void addMeshHelper (MeshHandle handle, const shapes::Mesh &cmesh)
 used within a Job to allow the main thread adding meshes
bool removeMeshHelper (MeshHandle handle)
 used within a Job to allow the main thread removing meshes
void addJob (const JobPtr &job) const
 add a Job for the main thread that needs to be executed there
void setSize (unsigned int width, unsigned int height)
 sets the size of the frame buffers
Protected Attributes inherited from mesh_filter::MeshFilterBase
std::map< MeshHandle, GLMeshPtr > meshes_
 storage for meshed to be filtered
SensorModel::ParametersPtr sensor_parameters_
 the parameters of the used sensor model
MeshHandle next_handle_
 next handle to be used for next mesh that is added
MeshHandle min_handle_
 Handle values below this are all taken (this variable is used for more efficient computation of next_label_).
std::thread filter_thread_
 the filtering thread that also holds the OpenGL context
std::condition_variable jobs_condition_
 condition variable to notify the filtering thread if a new image arrived
std::mutex jobs_mutex_
 mutex required for synchronization of condition states
std::queue< JobPtr > jobs_queue_
 OpenGL job queue that need to be processed by the worker thread.
std::mutex meshes_mutex_
 mutex for synchronization of updating filtered meshes
std::mutex transform_callback_mutex_
 mutex for synchronization of setting/calling transform_callback_
bool stop_
 indicates whether the filtering loop should stop
GLRendererPtr mesh_renderer_
 first pass renderer for rendering the mesh
GLRendererPtr depth_filter_
 second pass renderer for filtering the results of first pass
GLuint canvas_
 canvas element (screen-filling quad) for second pass
GLuint sensor_depth_texture_
 handle depth texture from sensor data
GLuint shadow_threshold_location_
 handle to GLSL location of shadow threshold
TransformCallback transform_callback_
 callback function for retrieving the mesh transformations
float padding_scale_
 padding scale
float padding_offset_
 padding offset
float shadow_threshold_
 threshold for shadowed pixels vs. filtered pixels

Detailed Description

template<typename SensorType>
class mesh_filter::MeshFilter< SensorType >

MeshFilter filters out points that belong to given meshes in depth-images.

Author
Suat Gedikli (gedik.nosp@m.li@w.nosp@m.illow.nosp@m.gara.nosp@m.ge.co.nosp@m.m)

Definition at line 60 of file mesh_filter.hpp.

Constructor & Destructor Documentation

◆ MeshFilter()

template<typename SensorType>
mesh_filter::MeshFilter< SensorType >::MeshFilter ( const TransformCallback & transform_callback = TransformCallback(),
const typename SensorType::Parameters & sensor_parameters = typename SensorType::Parameters() )

Constructor.

Author
Suat Gedikli (gedik.nosp@m.li@w.nosp@m.illow.nosp@m.gara.nosp@m.ge.co.nosp@m.m)
Parameters
[in]transform_callbackCallback function that is called for each mesh to obtain the current transformation.
Note
the callback expects the mesh handle but no time stamp. Its the users responsibility to return the correct transformation.

Definition at line 91 of file mesh_filter.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ MOVEIT_DECLARE_PTR_MEMBER()

template<typename SensorType>
mesh_filter::MeshFilter< SensorType >::MOVEIT_DECLARE_PTR_MEMBER ( MeshFilter< SensorType > )
Here is the call graph for this function:

◆ parameters() [1/2]

template<typename SensorType>
SensorType::Parameters & mesh_filter::MeshFilter< SensorType >::parameters ( )

returns the Sensor Parameters

Author
Suat Gedikli (gedik.nosp@m.li@w.nosp@m.illow.nosp@m.gara.nosp@m.ge.co.nosp@m.m)
Returns
reference of the parameters object of the used Sensor

Definition at line 100 of file mesh_filter.hpp.

◆ parameters() [2/2]

template<typename SensorType>
const SensorType::Parameters & mesh_filter::MeshFilter< SensorType >::parameters ( ) const

returns the Sensor Parameters

Author
Suat Gedikli (gedik.nosp@m.li@w.nosp@m.illow.nosp@m.gara.nosp@m.ge.co.nosp@m.m)
Returns
const reference of the parameters object of the used Sensor

Definition at line 106 of file mesh_filter.hpp.


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