crop_box.h
Go to the documentation of this file.
1 /*
2  *
3  * Software License Agreement (BSD License)
4  *
5  * Copyright (c) 2010, Willow Garage, Inc.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * * Neither the name of Willow Garage, Inc. nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  *
35  * $Id: cropbox.cpp
36  *
37  */
38 
39 #ifndef PCL_ROS_FILTERS_CROPBOX_H_
40 #define PCL_ROS_FILTERS_CROPBOX_H_
41 
42 // PCL includes
43 #include <pcl/filters/crop_box.h>
44 #include "pcl_ros/filters/filter.h"
45 
46 // Dynamic reconfigure
47 #include "pcl_ros/CropBoxConfig.h"
48 
49 namespace pcl_ros
50 {
57  class CropBox : public Filter
58  {
59  protected:
62 
68  inline void
69  filter (const PointCloud2::ConstPtr &input, const IndicesPtr &indices,
70  PointCloud2 &output)
71  {
72  boost::mutex::scoped_lock lock (mutex_);
73  pcl::PCLPointCloud2::Ptr pcl_input(new pcl::PCLPointCloud2);
74  pcl_conversions::toPCL (*(input), *(pcl_input));
75  impl_.setInputCloud (pcl_input);
76  impl_.setIndices (indices);
77  pcl::PCLPointCloud2 pcl_output;
78  impl_.filter (pcl_output);
79  pcl_conversions::moveFromPCL(pcl_output, output);
80  }
81 
86  bool
87  child_init (ros::NodeHandle &nh, bool &has_service);
88 
93  void
94  config_callback (pcl_ros::CropBoxConfig &config, uint32_t level);
95 
96  private:
98  pcl::CropBox<pcl::PCLPointCloud2> impl_;
99  public:
100  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
101  };
102 }
103 
104 #endif //#ifndef PCL_ROS_FILTERS_CROPBOX_H_
pcl::CropBox< pcl::PCLPointCloud2 > impl_
The PCL filter implementation used.
Definition: crop_box.h:98
Filter represents the base filter class. Some generic 3D operations that are applicable to all filter...
Definition: filter.h:57
sensor_msgs::PointCloud2 PointCloud2
Definition: filter.h:60
CropBox is a filter that allows the user to filter all the data inside of a given box...
Definition: crop_box.h:57
boost::mutex mutex_
Internal mutex.
Definition: filter.h:95
void config_callback(pcl_ros::CropBoxConfig &config, uint32_t level)
Dynamic reconfigure service callback.
Definition: crop_box.cpp:57
bool child_init(ros::NodeHandle &nh, bool &has_service)
Child initialization routine.
Definition: crop_box.cpp:44
void filter(const PointCloud2::ConstPtr &input, const IndicesPtr &indices, PointCloud2 &output)
Call the actual filter.
Definition: crop_box.h:69
void moveFromPCL(pcl::PCLImage &pcl_image, sensor_msgs::Image &image)
boost::shared_ptr< dynamic_reconfigure::Server< pcl_ros::CropBoxConfig > > srv_
Pointer to a dynamic reconfigure service.
Definition: crop_box.h:61
void toPCL(const ros::Time &stamp, pcl::uint64_t &pcl_stamp)


pcl_ros
Author(s): Open Perception, Julius Kammerl , William Woodall
autogenerated on Wed Jun 5 2019 19:52:52