depth_layer.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2016, Fetch Robotics Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Fetch Robotics Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL FETCH ROBOTICS INC. BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 // Author: Anuj Pasricha, Michael Ferguson
30 
31 #ifndef FETCH_DEPTH_LAYER_DEPTH_LAYER_H
32 #define FETCH_DEPTH_LAYER_DEPTH_LAYER_H
33 
34 #include <boost/thread/mutex.hpp>
35 #include <boost/shared_ptr.hpp>
36 #include <costmap_2d/voxel_layer.h>
37 #include <cv_bridge/cv_bridge.h>
40 #include <tf2_ros/message_filter.h>
42 
43 #include <opencv2/rgbd.hpp>
44 using cv::rgbd::DepthCleaner;
45 using cv::rgbd::RgbdNormals;
46 using cv::rgbd::RgbdPlane;
47 using cv::rgbd::depthTo3d;
48 
49 namespace costmap_2d
50 {
51 
57 {
58 public:
63 
67  virtual ~FetchDepthLayer();
68 
72  virtual void onInitialize();
73 
74 private:
75  void cameraInfoCallback(
76  const sensor_msgs::CameraInfo::ConstPtr& msg);
77  void depthImageCallback(
78  const sensor_msgs::Image::ConstPtr& msg);
79 
82 
83  // should we publish the marking/clearing observations
85 
86  // distance away from ground plane at which
87  // something is considered an obstacle
89 
90  // should we dynamically find the ground plane?
92 
93  // if finding ground plane, limit the tilt
94  // with respect to base_link frame
96 
97  // should NANs be treated as +inf and used for clearing
99 
100  // skipping of potentially noisy rays near the edge of the image
105 
106  // should skipped edge rays be used for clearing?
108 
109  // retrieves depth image from head_camera
110  // used to fit ground plane to
113 
114  // retrieves camera matrix for head_camera
115  // used in calculating ground plane
117 
118  // publishes clearing observations
120 
121  // publishes marking observations
123 
124  // camera intrinsics
125  boost::mutex mutex_K_;
126  cv::Mat K_;
127 
128  // clean the depth image
129  cv::Ptr<DepthCleaner> depth_cleaner_;
130 
131  // depth image estimation
132  cv::Ptr<RgbdNormals> normals_estimator_;
133  cv::Ptr<RgbdPlane> plane_estimator_;
134 };
135 
136 } // namespace costmap_2d
137 
138 #endif // FETCH_DEPTH_LAYER_DEPTH_LAYER_H
ros::Subscriber camera_info_sub_
Definition: depth_layer.h:116
virtual ~FetchDepthLayer()
Destructor for the depth costmap layer.
cv::Ptr< DepthCleaner > depth_cleaner_
Definition: depth_layer.h:129
cv::Ptr< RgbdNormals > normals_estimator_
Definition: depth_layer.h:132
void depthImageCallback(const sensor_msgs::Image::ConstPtr &msg)
void cameraInfoCallback(const sensor_msgs::CameraInfo::ConstPtr &msg)
cv::Ptr< RgbdPlane > plane_estimator_
Definition: depth_layer.h:133
virtual void onInitialize()
Initialization function for the DepthLayer.
Definition: depth_layer.cpp:45
ros::Publisher clearing_pub_
Definition: depth_layer.h:119
boost::shared_ptr< tf2_ros::MessageFilter< sensor_msgs::Image > > depth_image_filter_
Definition: depth_layer.h:112
boost::shared_ptr< costmap_2d::ObservationBuffer > marking_buf_
Definition: depth_layer.h:80
ros::Publisher marking_pub_
Definition: depth_layer.h:122
A costmap layer that extracts ground plane and clears it.
Definition: depth_layer.h:56
boost::shared_ptr< message_filters::Subscriber< sensor_msgs::Image > > depth_image_sub_
Definition: depth_layer.h:111
boost::shared_ptr< costmap_2d::ObservationBuffer > clearing_buf_
Definition: depth_layer.h:81
FetchDepthLayer()
Constructor.
Definition: depth_layer.cpp:41


fetch_depth_layer
Author(s): Michael Ferguson
autogenerated on Mon Feb 28 2022 22:23:51