37 #ifndef MOVEIT_MESH_FILTER_MESH_FILTER_BASE_ 38 #define MOVEIT_MESH_FILTER_MESH_FILTER_BASE_ 44 #include <boost/function.hpp> 45 #include <boost/thread/mutex.hpp> 46 #include <Eigen/Eigen> 89 const std::string& render_vertex_shader =
"",
const std::string& render_fragment_shader =
"",
90 const std::string& filter_vertex_shader =
"",
const std::string& filter_fragment_shader =
"");
109 void removeMesh(MeshHandle mesh_handle);
117 void filter(
const void* sensor_data, GLushort type,
bool wait =
false)
const;
127 void getFilteredLabels(LabelType* labels)
const;
134 void getFilteredDepth(
float* depth)
const;
145 void getModelLabels(LabelType* labels)
const;
152 void getModelDepth(
float* depth)
const;
161 void setShadowThreshold(
float threshold);
168 void setTransformCallback(
const TransformCallback& transform_callback);
175 void setPaddingScale(
float scale);
181 void setPaddingOffset(
float offset);
187 void initialize(
const std::string& render_vertex_shader,
const std::string& render_fragment_shader,
188 const std::string& filter_vertex_shader,
const std::string& filter_fragment_shader);
198 void run(
const std::string& render_vertex_shader,
const std::string& render_fragment_shader,
199 const std::string& filter_vertex_shader,
const std::string& filter_fragment_shader);
206 void doFilter(
const void* sensor_data,
const int encoding)
const;
213 void addMeshHelper(MeshHandle handle,
const shapes::Mesh* cmesh);
219 bool removeMeshHelper(MeshHandle handle);
225 void addJob(
const JobPtr& job)
const;
233 void setSize(
unsigned int width,
unsigned int height);
float padding_offset_
padding offset
boost::mutex meshes_mutex_
mutex for synchronization of updating filtered meshes
boost::mutex jobs_mutex_
mutex required for synchronization of condition states
ROSCONSOLE_DECL void initialize()
GLRendererPtr mesh_renderer_
first pass renderer for rendering the mesh
float padding_scale_
padding scale
GLuint sensor_depth_texture_
handle depth texture from sensor data
GLuint canvas_
canvas element (screen-filling quad) for second pass
TransformCallback transform_callback_
callback function for retrieving the mesh transformations
SensorModel::ParametersPtr sensor_parameters_
the parameters of the used sensor model
MeshHandle min_handle_
Handle values below this are all taken (this variable is used for more efficient computation of next_...
MOVEIT_CLASS_FORWARD(Shape)
MeshHandle next_handle_
next handle to be used for next mesh that is added
float shadow_threshold_
threshold for shadowed pixels vs. filtered pixels
Abstract Interface defining Sensor Parameters.
bool stop_
indicates whether the filtering loop should stop
boost::condition_variable jobs_condition_
condition variable to notify the filtering thread if a new image arrived
boost::thread filter_thread_
the filtering thread that also holds the OpenGL context
std::map< MeshHandle, GLMeshPtr > meshes_
storage for meshed to be filtered
boost::mutex transform_callback_mutex_
mutex for synchronization of setting/calling transform_callback_
GLuint shadow_threshold_location_
handle to GLSL location of shadow threshold
void run(ClassLoader *loader)
std::queue< JobPtr > jobs_queue_
OpenGL job queue that need to be processed by the worker thread.
boost::function< bool(MeshHandle, Eigen::Affine3d &)> TransformCallback
GLRendererPtr depth_filter_
second pass renderer for filtering the results of first pass