00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Copyright (c) 2010, Willow Garage, Inc. 00005 * All rights reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * * Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * * Redistributions in binary form must reproduce the above 00014 * copyright notice, this list of conditions and the following 00015 * disclaimer in the documentation and/or other materials provided 00016 * with the distribution. 00017 * * Neither the name of Willow Garage, Inc. nor the names of its 00018 * contributors may be used to endorse or promote products derived 00019 * from this software without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00022 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00023 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00024 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00025 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00026 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00027 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00028 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00029 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00030 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00031 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00032 * POSSIBILITY OF SUCH DAMAGE. 00033 * 00034 * $Id: moving_least_squares.h 36097 2011-02-20 14:18:58Z marton $ 00035 * 00036 */ 00037 00038 #ifndef PCL_ROS_MOVING_LEAST_SQUARES_H_ 00039 #define PCL_ROS_MOVING_LEAST_SQUARES_H_ 00040 00041 #include "pcl_ros/pcl_nodelet.h" 00042 00043 // PCL includes 00044 #include <pcl/surface/mls.h> 00045 00046 // Dynamic reconfigure 00047 #include <dynamic_reconfigure/server.h> 00048 #include "pcl_ros/MLSConfig.h" 00049 00050 namespace pcl_ros 00051 { 00052 namespace sync_policies = message_filters::sync_policies; 00053 00059 class MovingLeastSquares : public PCLNodelet 00060 { 00061 typedef pcl::PointXYZ PointIn; 00062 typedef pcl::PointNormal NormalOut; 00063 00064 typedef pcl::PointCloud<PointIn> PointCloudIn; 00065 typedef PointCloudIn::Ptr PointCloudInPtr; 00066 typedef PointCloudIn::ConstPtr PointCloudInConstPtr; 00067 typedef pcl::PointCloud<NormalOut> NormalCloudOut; 00068 00069 typedef pcl::KdTree<PointIn> KdTree; 00070 typedef pcl::KdTree<PointIn>::Ptr KdTreePtr; 00071 00072 protected: 00074 PointCloudInConstPtr surface_; 00075 00077 KdTreePtr tree_; 00078 00080 double search_radius_; 00081 00083 //int k_; 00084 00086 bool use_polynomial_fit_; 00087 00089 int polynomial_order_; 00090 00092 double gaussian_parameter_; 00093 00094 // ROS nodelet attributes 00096 message_filters::Subscriber<PointCloudIn> sub_surface_filter_; 00097 00103 int spatial_locator_type_; 00104 00106 boost::shared_ptr <dynamic_reconfigure::Server<MLSConfig> > srv_; 00107 00112 void config_callback (MLSConfig &config, uint32_t level); 00113 00114 private: 00116 virtual void onInit (); 00117 00122 void input_indices_callback (const PointCloudInConstPtr &cloud, 00123 const PointIndicesConstPtr &indices); 00124 00125 00126 private: 00128 pcl::MovingLeastSquares<PointIn, NormalOut> impl_; 00129 00131 ros::Subscriber sub_input_; 00132 00134 ros::Publisher pub_normals_; 00135 00137 boost::shared_ptr<message_filters::Synchronizer<sync_policies::ExactTime<PointCloudIn, PointIndices> > > sync_input_indices_e_; 00138 boost::shared_ptr<message_filters::Synchronizer<sync_policies::ApproximateTime<PointCloudIn, PointIndices> > > sync_input_indices_a_; 00139 00140 public: 00141 EIGEN_MAKE_ALIGNED_OPERATOR_NEW 00142 }; 00143 } 00144 00145 #endif //#ifndef PCL_ROS_MOVING_LEAST_SQUARES_H_