moveit2
The MoveIt Motion Planning Framework for ROS 2.
depth_self_filter_nodelet.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2013, Willow Garage, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Willow Garage nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
35 /* Author: Suat Gedikli */
36 
37 #pragma once
38 
39 #include <nodelet/nodelet.h>
40 #include <image_transport/image_transport.h>
44 #include <cv_bridge/cv_bridge.h>
45 #include <memory>
46 
47 namespace mesh_filter
48 {
54 class DepthSelfFiltering : public nodelet::Nodelet
55 {
56 public:
58  void onInit() override;
59 
60 private:
61  ~DepthSelfFiltering() override;
62 
69 
74  void filter(const sensor_msgs::ImageConstPtr& depth_msg, const sensor_msgs::CameraInfoConstPtr& info_msg);
75 
80  void connectCb();
81 
88  void depthCb(const sensor_msgs::ImageConstPtr& depth_msg, const sensor_msgs::CameraInfoConstPtr& info_msg);
89 
90 private:
91  // member variables to handle ros messages
92  std::shared_ptr<image_transport::ImageTransport> input_depth_transport_;
93  std::shared_ptr<image_transport::ImageTransport> filtered_label_transport_;
94  std::shared_ptr<image_transport::ImageTransport> filtered_depth_transport_;
95  std::shared_ptr<image_transport::ImageTransport> model_depth_transport_;
96  std::shared_ptr<image_transport::ImageTransport> model_label_transport_;
97  image_transport::CameraSubscriber sub_depth_image_;
98  image_transport::CameraPublisher pub_filtered_depth_image_;
99  image_transport::CameraPublisher pub_filtered_label_image_;
100  image_transport::CameraPublisher pub_model_depth_image_;
101  image_transport::CameraPublisher pub_model_label_image_;
102 
104  std::mutex connect_mutex_;
105  int queue_size_;
106  TransformProvider transform_provider_;
107 
108  std::shared_ptr<cv_bridge::CvImage> filtered_depth_ptr_;
109  std::shared_ptr<cv_bridge::CvImage> filtered_label_ptr_;
110  std::shared_ptr<cv_bridge::CvImage> model_depth_ptr_;
111  std::shared_ptr<cv_bridge::CvImage> model_label_ptr_;
113  double near_clipping_plane_distance_;
114 
116  double far_clipping_plane_distance_;
117 
119  double shadow_threshold_;
120 
122  double padding_scale_;
123 
125  double padding_offset_;
126 
129 };
130 
131 } // namespace mesh_filter
Class that caches and updates transformations for given frames.
Nodelet for filtering meshes from depth images. e.g. meshes of the robot or any attached object where...
void onInit() override
Nodelet init callback.